Messages in this thread Patch in this message | | | Date | Wed, 28 Mar 2007 19:23:32 +0200 (CEST) | From | Jiri Kosina <> | Subject | Re: fs/block_dev.c:953: warning: 'found' might be used uninitialized in this function |
| |
On Wed, 28 Mar 2007, Lee Revell wrote:
> > I compiled current git source 2.6.21-rc5-g28defbe and got this warning: > > ... > > fs/block_dev.c: In function `bd_claim_by_kobject': > > fs/block_dev.c:953: warning: 'found' might be used uninitialized in this > > function > > ... > Most of these warnings are really GCC bugs. Please examine the code > in question.
Anyway imho this time gcc got it right?
From: Jiri Kosina <jkosina@suse.cz>
blockdev: bd_claim_by_kobject() could check value of unititalized pointer
Fixes this warning:
fs/block_dev.c: In function `bd_claim_by_kobject': fs/block_dev.c:953: warning: 'found' might be used uninitialized in this function
struct bd_holder *found is initialized only when bd_claim() returns zero. If it returns nonzero, ptr stays uninitialized. Later the value of the pointer is checked.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
diff --git a/drivers/usb/input/hid-tmff.c b/drivers/usb/input/hid-tmff.c diff --git a/fs/block_dev.c b/fs/block_dev.c index 575076c..e87d84a 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -950,7 +950,7 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder, struct kobject *kobj) { int res; - struct bd_holder *bo, *found; + struct bd_holder *bo, *found = NULL; if (!kobj) return -EINVAL; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |