Re: [PATCH] Btrfs: fix return value check in btrfs_ioctl_send()
From: David Sterba <hidden>
Date: 2012-09-24 12:43:29
On Fri, Sep 21, 2012 at 12:42:02PM +0800, Wei Yongjun wrote:
From: Wei Yongjun <redacted> In case of error, the function btrfs_read_fs_root_no_name() returns ERR_PTR() and never returns NULL pointer. The NULL test in the return value check should be replaced with IS_ERR(), and remove useless NULL test.
Good catch. Also please update the other remaining case in
disk-io.c:open_ctree()
2587 fs_info->fs_root = btrfs_read_fs_root_no_name(fs_info, &location);
2588 if (!fs_info->fs_root)
2589 goto fail_qgroup;
2590 if (IS_ERR(fs_info->fs_root)) {
2591 err = PTR_ERR(fs_info->fs_root);
2592 goto fail_qgroup;
2593 }
dpatch engine is used to auto generated this patch. (https://github.com/weiyj/dpatch)
I've played with it, looks nice, although it's full of hardcoded paths. I'd like to run it directly from the git repo. Can you please fix that? No patch from me, because I hadcoded my paths :) It would be great if we can run a set of .cocci scripts that would verify code invariants (limited to cocci capabilities, but eg. the IS_ERR is a good example) and add new ones eventually over time. david