lkml.org 
[lkml]   [2019]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] afs: Fix afs_xattr_get_yfs() to not try freeing an error value


Am 12.05.2019 20:10, schrieb David Howells:
> walter harms <wharms@bfs.de> wrote:
>
>>> + ret = dsize;
>>> + if (size > 0) {
>>> + if (dsize > size) {
>>> + ret = -ERANGE;
>>> + goto error_key;
>>> }
>>> + memcpy(buffer, data, dsize);
>>> }
>>>
>>
>> i am confused: if size is <= 0 then the error is in dsize ?
>
> See this bit, before that hunk:
>
>> + if (ret < 0)
>> + goto error_key;
>
> David
>

Sorry, you misunderstood me, my fault, i did not see that size is unsigned.
NTL i do not think size=0 is useful.

You get size from outside, and if i follow the flow correct
the first use of it is to check size>0.
perhaps you can check size at start and simply return.
Now if size==0 it will return dsize and give the impression
that buffer is used (it is not).

while you are there:
flags |= YFS_ACL_WANT_ACL is always flags = YFS_ACL_WANT_ACL;
since flags is 0 at this point.
IMHO that sould be moved to the strcmp() section.

hope that helps,

re,
wh

\
 
 \ /
  Last update: 2019-05-12 20:44    [W:0.061 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site