linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* Re: f2fs: add key function to handle inline dir
@ 2014-10-21 12:53 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-10-21 12:53 UTC (permalink / raw)
  To: chao2.yu; +Cc: linux-f2fs-devel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-21 12:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 12:53 f2fs: add key function to handle inline dir Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).