From: Andrew Morton <akpm@linux-foundation.org>
To: "young dave" <hidave.darkstar@gmail.com>
Cc: "Christoph Lameter" <clameter@sgi.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Anton Altaparmakov" <aia21@cantab.net>
Subject: Re: 2.6.22-rc2-mm1 NTFS & SLUB related fix
Date: Fri, 25 May 2007 00:01:15 -0700 [thread overview]
Message-ID: <20070525000115.e24e027a.akpm@linux-foundation.org> (raw)
In-Reply-To: <a8e1da0705242348n12aebed7m254677969d718bde@mail.gmail.com>
On Fri, 25 May 2007 06:48:34 +0000 "young dave" <hidave.darkstar@gmail.com> wrote:
> Yes, I'm sure. but the patch in top post of mine works, the diffrence
> is using kzalloc and remove the "ni->name[i] = 0;" line.
>
Let's walk through the existing code:
i = na->name_len * sizeof(ntfschar);
now, i = na->name_len * 2
ni->name = kmalloc(i + sizeof(ntfschar), GFP_ATOMIC);
we allocated (na->name_len * 2 + 2) bytes
if (!ni->name)
return -ENOMEM;
memcpy(ni->name, na->name, i);
we copied (na->name_len * 2) bytes
ni->name[i] = 0;
here, we zero the two bytes at byte offsets ((na->name_len * 2) * 2) and
((na->name_len * 2) * 2 + 1), and that is the bug. We _want_ to zero
the two bytes at byte offsets (na->name_len * 2) and (na->name_len * 2 + 1),
which we can do in C via
ni->name[na->name_len] = 0;
because sizeof(*(ni->name)) == 2.
So I'm still suspecting that you mistested that change.
next prev parent reply other threads:[~2007-05-25 7:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-25 5:01 2.6.22-rc2-mm1 NTFS & SLUB related fix young dave
2007-05-25 5:07 ` Christoph Lameter
2007-05-25 5:22 ` young dave
2007-05-25 5:47 ` Andrew Morton
2007-05-25 6:27 ` young dave
2007-05-25 6:43 ` Andrew Morton
2007-05-25 6:48 ` young dave
2007-05-25 7:01 ` Andrew Morton [this message]
2007-05-25 7:10 ` young dave
2007-05-25 7:18 ` Andrew Morton
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=20070525000115.e24e027a.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aia21@cantab.net \
--cc=clameter@sgi.com \
--cc=hidave.darkstar@gmail.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