fs/qnx4: decrement sizeof size in strncmp
authorJulia Lawall <julia@diku.dk>
Thu, 12 Nov 2009 22:08:36 +0000 (23:08 +0100)
committerJiri Kosina <jkosina@suse.cz>
Thu, 4 Feb 2010 10:55:46 +0000 (11:55 +0100)
As an identical match is wanted in this case, strcmp can be used instead.

The semantic match that lead to detecting this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression foo;
constant char *abc;
@@

*strncmp(foo, abc, sizeof(abc))
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Anders Larsen <al@alarsen.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
fs/qnx4/inode.c

index ebf3440d28cae26df7fcff9f7d1da3c6b897bc3e..277575ddc05cbc25035cd335d9acce319c731226 100644 (file)
@@ -201,7 +201,8 @@ static const char *qnx4_checkroot(struct super_block *sb)
                                rootdir = (struct qnx4_inode_entry *) (bh->b_data + i * QNX4_DIR_ENTRY_SIZE);
                                if (rootdir->di_fname != NULL) {
                                        QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname));
-                                       if (!strncmp(rootdir->di_fname, QNX4_BMNAME, sizeof QNX4_BMNAME)) {
+                                       if (!strcmp(rootdir->di_fname,
+                                                   QNX4_BMNAME)) {
                                                found = 1;
                                                qnx4_sb(sb)->BitMap = kmalloc( sizeof( struct qnx4_inode_entry ), GFP_KERNEL );
                                                if (!qnx4_sb(sb)->BitMap) {