ncpfs: fix wrong check in __ncp_ioctl()
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 22 Sep 2009 23:45:55 +0000 (16:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Sep 2009 14:39:42 +0000 (07:39 -0700)
We want to check for s_inode's existence, not inode's one (inode is always
valid in this function).

This takes care of the following entry from Dan's list:

fs/ncpfs/ioctl.c +445 __ncp_ioctl(180) warning: variable derefenced before check 'inode'

Reported-by: Dan Carpenter <error27@gmail.com>
Cc: Julia Lawall <julia@diku.dk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ncpfs/ioctl.c

index fa038df63ac8dbea24c47789a13c7a933d8c54b0..53a7ed7eb9c66da4b69090789afae1e3c5772e7b 100644 (file)
@@ -442,7 +442,7 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp,
                        if (dentry) {
                                struct inode* s_inode = dentry->d_inode;
                                
-                               if (inode) {
+                               if (s_inode) {
                                        NCP_FINFO(s_inode)->volNumber = vnum;
                                        NCP_FINFO(s_inode)->dirEntNum = de;
                                        NCP_FINFO(s_inode)->DosDirNum = dosde;