Hello Chao Yu,

The patch 9f06d1bb7c87: "f2fs: add key function to handle inline dir"
from Sep 24, 2014, leads to the following static checker warning:

        fs/f2fs/inline.c:358 f2fs_convert_inline_dir()
        error: memcpy() 'dentry_blk->reserved' too small (3 vs 7)

fs/f2fs/inline.c
   355          /* copy data from inline dentry block to new dentry block */
   356          memcpy(dentry_blk->dentry_bitmap, inline_dentry->dentry_bitmap,
   357                                          INLINE_DENTRY_BITMAP_SIZE);
   358          memcpy(dentry_blk->reserved, inline_dentry->reserved,
   359                                          INLINE_RESERVED_SIZE);

This is a harmless buffer overflow because we correct it on the next
line, but dentry_blk->reserved is smaller than inline_dentry->reserved
so we're writing past the end.  We should just be clearing this anyway
instead of copying.

   360          memcpy(dentry_blk->dentry, inline_dentry->dentry,
   361                          sizeof(struct f2fs_dir_entry) * 
NR_INLINE_DENTRY);
   362          memcpy(dentry_blk->filename, inline_dentry->filename,
   363                                          NR_INLINE_DENTRY * 
F2FS_SLOT_LEN);
   364  

regards,
dan carpenter

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to