public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: filldir[64] oddness
Date: Wed, 8 Mar 2006 23:27:44 -0500	[thread overview]
Message-ID: <20060309042744.GA23148@redhat.com> (raw)

I'm puzzled by an aparent use of uninitialised memory
that coverity's checker picked up.

fs/readdir.c

#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 ?

		Dave

-- 
http://www.codemonkey.org.uk

             reply	other threads:[~2006-03-09  4:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09  4:27 Dave Jones [this message]
2006-03-09  4:32 ` filldir[64] oddness David S. Miller
2006-03-09  4:38   ` Dave Jones
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=20060309042744.GA23148@redhat.com \
    --to=davej@redhat.com \
    --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