From: walter harms <wharms@bfs.de>
To: David Howells <dhowells@redhat.com>
Cc: colin.king@canonical.com, joe@perches.com, jaltman@auristor.com,
linux-afs@lists.infradead.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] afs: Fix afs_xattr_get_yfs() to not try freeing an error value
Date: Sun, 12 May 2019 18:44:11 +0000 [thread overview]
Message-ID: <5CD8697B.6010004@bfs.de> (raw)
In-Reply-To: <31808.1557684645@warthog.procyon.org.uk>
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
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: David Howells <dhowells@redhat.com>
Cc: colin.king@canonical.com, joe@perches.com, jaltman@auristor.com,
linux-afs@lists.infradead.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] afs: Fix afs_xattr_get_yfs() to not try freeing an error value
Date: Sun, 12 May 2019 20:44:11 +0200 [thread overview]
Message-ID: <5CD8697B.6010004@bfs.de> (raw)
In-Reply-To: <31808.1557684645@warthog.procyon.org.uk>
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
next prev parent reply other threads:[~2019-05-12 18:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-12 7:45 [PATCH 1/2] afs: Fix incorrect error handling in afs_xattr_get_acl() David Howells
2019-05-12 7:45 ` David Howells
2019-05-12 7:45 ` [PATCH 2/2] afs: Fix afs_xattr_get_yfs() to not try freeing an error value David Howells
2019-05-12 7:45 ` David Howells
2019-05-12 16:07 ` walter harms
2019-05-12 16:07 ` walter harms
2019-05-12 18:10 ` David Howells
2019-05-12 18:10 ` David Howells
2019-05-12 18:44 ` walter harms [this message]
2019-05-12 18:44 ` walter harms
2019-05-12 20:06 ` David Howells
2019-05-12 20:06 ` David Howells
2019-05-13 10:13 ` walter harms
2019-05-13 10:13 ` walter harms
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=5CD8697B.6010004@bfs.de \
--to=wharms@bfs.de \
--cc=colin.king@canonical.com \
--cc=dhowells@redhat.com \
--cc=jaltman@auristor.com \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-afs@lists.infradead.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.