Skip to contentSkip to conversation

fs/ntfs/super.c:2717:1-14: alloc with no test

DISCUSSION Fengguang Wu 2 participants 3 messages Aug 26, 2012 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hi Anton,

FYI, coccinelle warns about

fs/ntfs/super.c:2717:1-14: alloc with no test, possible model on line 2718

vim +2717 fs/ntfs/super.c
2714 sb->s_flags |= MS_RDONLY;
2715 #endif /* ! NTFS_RW */
2716 /* Allocate a new ntfs_volume and place it in sb->s_fs_info. */

Quoted 1 line

2717 sb->s_fs_info = kmalloc(sizeof(ntfs_volume), GFP_NOFS);

2718 vol = NTFS_SB(sb);
2719 if (!vol) {
2720 if (!silent)

---
0-DAY kernel build testing backend Open Source Technology Centre
Fengguang Wu <[email protected]> Intel Corporation

#1 lore raw
Quoted 12 lines · Fengguang Wu

Hi Anton,

FYI, coccinelle warns about

fs/ntfs/super.c:2717:1-14: alloc with no test, possible model on line 2718

vim +2717 fs/ntfs/super.c
2714 sb->s_flags |= MS_RDONLY;
2715 #endif /* ! NTFS_RW */
2716 /* Allocate a new ntfs_volume and place it in sb->s_fs_info. */

Quoted 1 line

2717 sb->s_fs_info = kmalloc(sizeof(ntfs_volume), GFP_NOFS);

That's i think a false alarm.

Quoted 1 line
  2718          vol = NTFS_SB(sb);
The NTFS_SB(buf) {
      buf->s_fs_info;

}

so we are validating the allocated pointer s_fs_info.

correct me if i am wrong.

Thanks,

Quoted 11 lines
  2719          if (!vol) {
  2720                  if (!silent)

---
0-DAY kernel build testing backend Open Source Technology Centre
Fengguang Wu <[email protected]> Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
Quoted 16 lines · devendra.aaru
Quoted 12 lines · Fengguang Wu

Hi Anton,

FYI, coccinelle warns about

fs/ntfs/super.c:2717:1-14: alloc with no test, possible model on line 2718

vim +2717 fs/ntfs/super.c
2714 sb->s_flags |= MS_RDONLY;
2715 #endif /* ! NTFS_RW */
2716 /* Allocate a new ntfs_volume and place it in sb->s_fs_info. */

Quoted 1 line

2717 sb->s_fs_info = kmalloc(sizeof(ntfs_volume), GFP_NOFS);

That's i think a false alarm.

Quoted 7 lines
Quoted 1 line
  2718          vol = NTFS_SB(sb);
The NTFS_SB(buf) {
      buf->s_fs_info;

}

so we are validating the allocated pointer s_fs_info.

Yes, it is. Sorry for the noise!

Thanks,
Fengguang