lkml.org 
[lkml]   [2014]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs: fix d_path() with zero-length input buffer
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.



\
 
 \ /
  Last update: 2014-02-05 19:21    [W:0.028 / U:1.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site