linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: chao2.yu@samsung.com
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: f2fs: add key function to handle inline dir
Date: Tue, 21 Oct 2014 15:53:17 +0300	[thread overview]
Message-ID: <20141021125317.GA27182@mwanda> (raw)

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

                 reply	other threads:[~2014-10-21 12:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141021125317.GA27182@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=chao2.yu@samsung.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).