linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] audit: remove redundant condition check in kauditd_thread()
@ 2019-10-23 13:27 Yunfeng Ye
  2019-10-25  5:43 ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Yunfeng Ye @ 2019-10-23 13:27 UTC (permalink / raw)
  To: paul, eparis; +Cc: linux-audit, linux-kernel, hushiyuan, linfeilong

Warning is found by the code analysis tool:
  "the condition 'if(ac && rc < 0)' is redundant: ac"

The @ac variable has been checked before. It can't be a null pointer
here, so remove the redundant condition check.

Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
 kernel/audit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index da8dc0db5bd3..193f3a1f4425 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -830,7 +830,7 @@ static int kauditd_thread(void *dummy)
 		rc = kauditd_send_queue(sk, portid,
 					&audit_hold_queue, UNICAST_RETRIES,
 					NULL, kauditd_rehold_skb);
-		if (ac && rc < 0) {
+		if (rc < 0) {
 			sk = NULL;
 			auditd_reset(ac);
 			goto main_queue;
@@ -840,7 +840,7 @@ static int kauditd_thread(void *dummy)
 		rc = kauditd_send_queue(sk, portid,
 					&audit_retry_queue, UNICAST_RETRIES,
 					NULL, kauditd_hold_skb);
-		if (ac && rc < 0) {
+		if (rc < 0) {
 			sk = NULL;
 			auditd_reset(ac);
 			goto main_queue;
-- 
2.7.4.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] audit: remove redundant condition check in kauditd_thread()
  2019-10-23 13:27 [PATCH] audit: remove redundant condition check in kauditd_thread() Yunfeng Ye
@ 2019-10-25  5:43 ` Paul Moore
  2019-10-25  7:14   ` Yunfeng Ye
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Moore @ 2019-10-25  5:43 UTC (permalink / raw)
  To: Yunfeng Ye, eparis; +Cc: linux-audit, linux-kernel, hushiyuan, linfeilong

On October 23, 2019 3:27:50 PM Yunfeng Ye <yeyunfeng@huawei.com> wrote:
> Warning is found by the code analysis tool:
>  "the condition 'if(ac && rc < 0)' is redundant: ac"
>
>
> The @ac variable has been checked before. It can't be a null pointer
> here, so remove the redundant condition check.
>
>
> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
> ---
> kernel/audit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Hello,

Thank you for the patch.  Looking quickly at it, it appears to be correct, unfortunately I'm not in a position to merge non-critical patches, but I expect to merge this next week.


> diff --git a/kernel/audit.c b/kernel/audit.c
> index da8dc0db5bd3..193f3a1f4425 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -830,7 +830,7 @@ static int kauditd_thread(void *dummy)
>  rc = kauditd_send_queue(sk, portid,
>  &audit_hold_queue, UNICAST_RETRIES,
>  NULL, kauditd_rehold_skb);
> - if (ac && rc < 0) {
> + if (rc < 0) {
>  sk = NULL;
>  auditd_reset(ac);
>  goto main_queue;
> @@ -840,7 +840,7 @@ static int kauditd_thread(void *dummy)
>  rc = kauditd_send_queue(sk, portid,
>  &audit_retry_queue, UNICAST_RETRIES,
>  NULL, kauditd_hold_skb);
> - if (ac && rc < 0) {
> + if (rc < 0) {
>  sk = NULL;
>  auditd_reset(ac);
>  goto main_queue;
> --
> 2.7.4.3

--
paul moore
www.paul-moore.com





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] audit: remove redundant condition check in kauditd_thread()
  2019-10-25  5:43 ` Paul Moore
@ 2019-10-25  7:14   ` Yunfeng Ye
  2019-10-25 15:54     ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Yunfeng Ye @ 2019-10-25  7:14 UTC (permalink / raw)
  To: Paul Moore, eparis; +Cc: linux-audit, linux-kernel, hushiyuan, linfeilong



On 2019/10/25 13:43, Paul Moore wrote:
> On October 23, 2019 3:27:50 PM Yunfeng Ye <yeyunfeng@huawei.com> wrote:
>> Warning is found by the code analysis tool:
>>  "the condition 'if(ac && rc < 0)' is redundant: ac"
>>
>>
>> The @ac variable has been checked before. It can't be a null pointer
>> here, so remove the redundant condition check.
>>
>>
>> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
>> ---
>> kernel/audit.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Hello,
> 
> Thank you for the patch.  Looking quickly at it, it appears to be correct, unfortunately I'm not in a position to merge non-critical patches, but I expect to merge this next week.
> 
ok, thanks.

> 
>> diff --git a/kernel/audit.c b/kernel/audit.c
>> index da8dc0db5bd3..193f3a1f4425 100644
>> --- a/kernel/audit.c
>> +++ b/kernel/audit.c
>> @@ -830,7 +830,7 @@ static int kauditd_thread(void *dummy)
>>  rc = kauditd_send_queue(sk, portid,
>>  &audit_hold_queue, UNICAST_RETRIES,
>>  NULL, kauditd_rehold_skb);
>> - if (ac && rc < 0) {
>> + if (rc < 0) {
>>  sk = NULL;
>>  auditd_reset(ac);
>>  goto main_queue;
>> @@ -840,7 +840,7 @@ static int kauditd_thread(void *dummy)
>>  rc = kauditd_send_queue(sk, portid,
>>  &audit_retry_queue, UNICAST_RETRIES,
>>  NULL, kauditd_hold_skb);
>> - if (ac && rc < 0) {
>> + if (rc < 0) {
>>  sk = NULL;
>>  auditd_reset(ac);
>>  goto main_queue;
>> --
>> 2.7.4.3
> 
> --
> paul moore
> www.paul-moore.com
> 
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] audit: remove redundant condition check in kauditd_thread()
  2019-10-25  7:14   ` Yunfeng Ye
@ 2019-10-25 15:54     ` Paul Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2019-10-25 15:54 UTC (permalink / raw)
  To: Yunfeng Ye; +Cc: Eric Paris, linux-audit, linux-kernel, hushiyuan, linfeilong

On Fri, Oct 25, 2019 at 3:14 AM Yunfeng Ye <yeyunfeng@huawei.com> wrote:
> On 2019/10/25 13:43, Paul Moore wrote:
> > On October 23, 2019 3:27:50 PM Yunfeng Ye <yeyunfeng@huawei.com> wrote:
> >> Warning is found by the code analysis tool:
> >>  "the condition 'if(ac && rc < 0)' is redundant: ac"
> >>
> >>
> >> The @ac variable has been checked before. It can't be a null pointer
> >> here, so remove the redundant condition check.
> >>
> >>
> >> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
> >> ---
> >> kernel/audit.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > Hello,
> >
> > Thank you for the patch.  Looking quickly at it, it appears to be correct, unfortunately I'm not in a position to merge non-critical patches, but I expect to merge this next week.
> >
> ok, thanks.

I was able to find some time today to take a closer look and it still
looks good to me so I've merge it into audit/next - thanks!

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-25 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 13:27 [PATCH] audit: remove redundant condition check in kauditd_thread() Yunfeng Ye
2019-10-25  5:43 ` Paul Moore
2019-10-25  7:14   ` Yunfeng Ye
2019-10-25 15:54     ` Paul Moore

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).