From: Dave Jones <davej@redhat.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: filldir[64] oddness
Date: Wed, 8 Mar 2006 23:38:04 -0500 [thread overview]
Message-ID: <20060309043804.GB23148@redhat.com> (raw)
In-Reply-To: <20060308.203204.115109492.davem@davemloft.net>
On Wed, Mar 08, 2006 at 08:32:04PM -0800, David S. Miller wrote:
> From: Dave Jones <davej@redhat.com>
> Date: Wed, 8 Mar 2006 23:27:44 -0500
>
> > #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
> > #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
> >
> > 140 static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
> > 141 ino_t ino, unsigned int d_type)
> > 142 {
> > 143 struct linux_dirent __user * dirent;
> > 144 struct getdents_callback * buf = (struct getdents_callback *) __buf
> > 145 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
> >
> > How come that NAME_OFFSET isn't causing an oops when
> > it dereferences stackjunk->d_name ?
>
> d_name a char[] array, and we're just doing pointer arithmetic
> here. It's the same as "offsetof(d_name, struct linux_dirent)"
> or something like that.
Duh, yes. Of course.
> I think coverity is being trigger happy in this case :-)
agreed.
Dave
--
http://www.codemonkey.org.uk
next prev parent reply other threads:[~2006-03-09 4:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-09 4:27 filldir[64] oddness Dave Jones
2006-03-09 4:32 ` David S. Miller
2006-03-09 4:38 ` Dave Jones [this message]
2006-03-09 4:40 ` Al Viro
2006-03-09 17:02 ` Bryan O'Sullivan
2006-03-09 17:07 ` Dave Jones
2006-03-09 17:15 ` Bryan O'Sullivan
2006-03-09 17:27 ` Dave Jones
2006-03-10 1:41 ` Kyle Moffett
2006-03-10 1:44 ` Al Viro
2006-03-09 4:33 ` Vadim Lobanov
2006-03-09 4:34 ` Stephen Rothwell
2006-03-09 4:38 ` Al Viro
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=20060309043804.GB23148@redhat.com \
--to=davej@redhat.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
/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