From: Oleg Nesterov <oleg@redhat.com>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
Jan Kratochvil <jan.kratochvil@redhat.com>,
Amerigo Wang <amwang@redhat.com>,
"Jonathan M. Foote" <jmfoote@cert.org>,
Roland McGrath <roland@hack.frob.com>,
Pedro Alves <palves@redhat.com>,
Fengguang Wu <fengguang.wu@intel.com>,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH] fs: fix d_path() with zero-length input buffer
Date: Wed, 5 Feb 2014 18:42:45 +0100 [thread overview]
Message-ID: <20140205174245.GA26039@redhat.com> (raw)
In-Reply-To: <1391621647-7905-1-git-send-email-dvlasenk@redhat.com>
On 02/05, Denys Vlasenko wrote:
>
> In prepend_name(), *buflen < dlen + 1 comparison is buggy
> because dlen has unsigned data type, and we can reach this location
> with *buflen == -1.
because, say, path_with_deleted() doesn't check the result of
prepend(), and prepend() updates *buflen unconditionally. I am
wondering if it should be changed too just for consistency.
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -2833,7 +2833,7 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name)
> u32 dlen = ACCESS_ONCE(name->len);
> char *p;
>
> - if (*buflen < dlen + 1)
> + if (*buflen < (int)dlen + 1)
perhaps it would be better to simply make dlen "int" ?
Oleg.
prev parent reply other threads:[~2014-02-05 17:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-05 17:34 [PATCH] fs: fix d_path() with zero-length input buffer Denys Vlasenko
2014-02-05 17:42 ` Oleg Nesterov [this message]
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=20140205174245.GA26039@redhat.com \
--to=oleg@redhat.com \
--cc=amwang@redhat.com \
--cc=dvlasenk@redhat.com \
--cc=fengguang.wu@intel.com \
--cc=jan.kratochvil@redhat.com \
--cc=jmfoote@cert.org \
--cc=linux-kernel@vger.kernel.org \
--cc=palves@redhat.com \
--cc=roland@hack.frob.com \
--cc=sfr@canb.auug.org.au \
--cc=viro@zeniv.linux.org.uk \
/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).