Skip to content

Commit

Permalink
fs/qnx4: decrement sizeof size in strncmp
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Anders Larsen <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
Julia Lawall authored and Jiri Kosina committed Feb 4, 2010
1 parent fe9a230 commit 7e2a108
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/qnx4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7e2a108

Please sign in to comment.