Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1560783 > unrolled thread
| Started by | Casey Schaufler <casey@schaufler-ca.com> |
|---|---|
| First post | 2017-01-17 17:40 +0100 |
| Last post | 2017-01-17 19:00 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 15/46] selinux: One check and function call less in genfs_read() after error detection Casey Schaufler <casey@schaufler-ca.com> - 2017-01-17 17:40 +0100
Re: [PATCH 15/46] selinux: One check and function call less in genfs_read() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-17 17:40 +0100
Re: [PATCH 15/46] selinux: One check and function call less in genfs_read() after error detection Casey Schaufler <casey@schaufler-ca.com> - 2017-01-17 19:00 +0100
| From | Casey Schaufler <casey@schaufler-ca.com> |
|---|---|
| Date | 2017-01-17 17:40 +0100 |
| Subject | Re: [PATCH 15/46] selinux: One check and function call less in genfs_read() after error detection |
| Message-ID | <t0EXE-VQ-29@gated-at.bofh.it> |
On 1/15/2017 7:15 AM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 14 Jan 2017 18:29:20 +0100
>
> Adjust a jump target to avoid a check repetition at the end after a memory
> allocation failed for the local variable "newgenfs".
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> security/selinux/ss/policydb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
> index 5dc31faa601f..e7b882251da8 100644
> --- a/security/selinux/ss/policydb.c
> +++ b/security/selinux/ss/policydb.c
> @@ -2015,7 +2015,7 @@ static int genfs_read(struct policydb *p, void *fp)
> newgenfs = kzalloc(sizeof(*newgenfs), GFP_KERNEL);
> if (!newgenfs) {
> rc = -ENOMEM;
> - goto out;
> + goto exit;
> }
>
> rc = str_read(&newgenfs->fstype, GFP_KERNEL, fp, len);
> @@ -2101,7 +2101,7 @@ static int genfs_read(struct policydb *p, void *fp)
> kfree(newgenfs);
> }
> ocontext_destroy(newc, OCON_FSUSE);
> -
> +exit:
> return rc;
Why not replace the "goto out" with "return rc" rather
than add a target?
> }
>
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-01-17 17:40 +0100 |
| Message-ID | <t0EXF-VQ-47@gated-at.bofh.it> |
| In reply to | #1560783 |
>> @@ -2015,7 +2015,7 @@ static int genfs_read(struct policydb *p, void *fp)
>> newgenfs = kzalloc(sizeof(*newgenfs), GFP_KERNEL);
>> if (!newgenfs) {
>> rc = -ENOMEM;
>> - goto out;
>> + goto exit;
>> }
>>
>> rc = str_read(&newgenfs->fstype, GFP_KERNEL, fp, len);
>> @@ -2101,7 +2101,7 @@ static int genfs_read(struct policydb *p, void *fp)
>> kfree(newgenfs);
>> }
>> ocontext_destroy(newc, OCON_FSUSE);
>> -
>> +exit:
>> return rc;
>
> Why not replace the "goto out" with "return rc" rather
> than add a target?
Would you accept to use the statement "return -ENOMEM;" there instead?
Regards,
Markus
[toc] | [prev] | [next] | [standalone]
| From | Casey Schaufler <casey@schaufler-ca.com> |
|---|---|
| Date | 2017-01-17 19:00 +0100 |
| Message-ID | <t0Gd3-1D8-1@gated-at.bofh.it> |
| In reply to | #1560791 |
On 1/17/2017 8:37 AM, SF Markus Elfring wrote:
>>> @@ -2015,7 +2015,7 @@ static int genfs_read(struct policydb *p, void *fp)
>>> newgenfs = kzalloc(sizeof(*newgenfs), GFP_KERNEL);
>>> if (!newgenfs) {
>>> rc = -ENOMEM;
>>> - goto out;
>>> + goto exit;
>>> }
>>>
>>> rc = str_read(&newgenfs->fstype, GFP_KERNEL, fp, len);
>>> @@ -2101,7 +2101,7 @@ static int genfs_read(struct policydb *p, void *fp)
>>> kfree(newgenfs);
>>> }
>>> ocontext_destroy(newc, OCON_FSUSE);
>>> -
>>> +exit:
>>> return rc;
>> Why not replace the "goto out" with "return rc" rather
>> than add a target?
> Would you accept to use the statement "return -ENOMEM;" there instead?
That would be even better.
>
> Regards,
> Markus
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web