All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND -next] lsm_audit: Clean up redundant NULL pointer check
@ 2022-07-14  1:24 Xiu Jianfeng
  2022-07-14  2:33 ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Xiu Jianfeng @ 2022-07-14  1:24 UTC (permalink / raw)
  To: paul, jmorris, serge; +Cc: linux-security-module, linux-kernel

The implements of {ip,tcp,udp,dccp,sctp,ipv6}_hdr(skb) guarantee that
they will never return NULL, and elsewhere users don't do the check
as well, so remove the check here.

Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
 security/lsm_audit.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index 78a278f28e49..75cc3f8d2a42 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -44,9 +44,6 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb,
 	struct iphdr *ih;
 
 	ih = ip_hdr(skb);
-	if (ih == NULL)
-		return -EINVAL;
-
 	ad->u.net->v4info.saddr = ih->saddr;
 	ad->u.net->v4info.daddr = ih->daddr;
 
@@ -59,8 +56,6 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb,
 	switch (ih->protocol) {
 	case IPPROTO_TCP: {
 		struct tcphdr *th = tcp_hdr(skb);
-		if (th == NULL)
-			break;
 
 		ad->u.net->sport = th->source;
 		ad->u.net->dport = th->dest;
@@ -68,8 +63,6 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb,
 	}
 	case IPPROTO_UDP: {
 		struct udphdr *uh = udp_hdr(skb);
-		if (uh == NULL)
-			break;
 
 		ad->u.net->sport = uh->source;
 		ad->u.net->dport = uh->dest;
@@ -77,8 +70,6 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb,
 	}
 	case IPPROTO_DCCP: {
 		struct dccp_hdr *dh = dccp_hdr(skb);
-		if (dh == NULL)
-			break;
 
 		ad->u.net->sport = dh->dccph_sport;
 		ad->u.net->dport = dh->dccph_dport;
@@ -86,8 +77,7 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb,
 	}
 	case IPPROTO_SCTP: {
 		struct sctphdr *sh = sctp_hdr(skb);
-		if (sh == NULL)
-			break;
+
 		ad->u.net->sport = sh->source;
 		ad->u.net->dport = sh->dest;
 		break;
@@ -115,8 +105,6 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb,
 	__be16 frag_off;
 
 	ip6 = ipv6_hdr(skb);
-	if (ip6 == NULL)
-		return -EINVAL;
 	ad->u.net->v6info.saddr = ip6->saddr;
 	ad->u.net->v6info.daddr = ip6->daddr;
 	/* IPv6 can have several extension header before the Transport header
-- 
2.17.1


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

* Re: [PATCH RESEND -next] lsm_audit: Clean up redundant NULL pointer check
  2022-07-14  1:24 [PATCH RESEND -next] lsm_audit: Clean up redundant NULL pointer check Xiu Jianfeng
@ 2022-07-14  2:33 ` Paul Moore
  2022-07-14  2:48   ` xiujianfeng
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Moore @ 2022-07-14  2:33 UTC (permalink / raw)
  To: Xiu Jianfeng; +Cc: jmorris, serge, linux-security-module, linux-kernel

On Wed, Jul 13, 2022 at 9:27 PM Xiu Jianfeng <xiujianfeng@huawei.com> wrote:
>
> The implements of {ip,tcp,udp,dccp,sctp,ipv6}_hdr(skb) guarantee that
> they will never return NULL, and elsewhere users don't do the check
> as well, so remove the check here.
>
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> ---
>  security/lsm_audit.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)

Hi Xiu Jianfeng,

We just changed LSM maintainers earlier this week, and while I haven't
forgotten about your patch (I reviewed it previously), it is too late
in this current release cycle (-rc6) to merge non-critical fixes.
This would go into the LSM tree after the upcoming merge window.

Thank you for your patience and understanding.

-- 
paul-moore.com

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

* Re: [PATCH RESEND -next] lsm_audit: Clean up redundant NULL pointer check
  2022-07-14  2:33 ` Paul Moore
@ 2022-07-14  2:48   ` xiujianfeng
  2022-08-16  2:27     ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: xiujianfeng @ 2022-07-14  2:48 UTC (permalink / raw)
  To: Paul Moore; +Cc: jmorris, serge, linux-security-module, linux-kernel


在 2022/7/14 10:33, Paul Moore 写道:
> On Wed, Jul 13, 2022 at 9:27 PM Xiu Jianfeng <xiujianfeng@huawei.com> wrote:
>> The implements of {ip,tcp,udp,dccp,sctp,ipv6}_hdr(skb) guarantee that
>> they will never return NULL, and elsewhere users don't do the check
>> as well, so remove the check here.
>>
>> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
>> ---
>>   security/lsm_audit.c | 14 +-------------
>>   1 file changed, 1 insertion(+), 13 deletions(-)
> Hi Xiu Jianfeng,
>
> We just changed LSM maintainers earlier this week, and while I haven't
> forgotten about your patch (I reviewed it previously), it is too late
> in this current release cycle (-rc6) to merge non-critical fixes.
> This would go into the LSM tree after the upcoming merge window.
>
> Thank you for your patience and understanding.
Hi, paul, I get it, thanks very much :)
>

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

* Re: [PATCH RESEND -next] lsm_audit: Clean up redundant NULL pointer check
  2022-07-14  2:48   ` xiujianfeng
@ 2022-08-16  2:27     ` Paul Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2022-08-16  2:27 UTC (permalink / raw)
  To: xiujianfeng; +Cc: jmorris, serge, linux-security-module, linux-kernel

On Wed, Jul 13, 2022 at 10:49 PM xiujianfeng <xiujianfeng@huawei.com> wrote:
> 在 2022/7/14 10:33, Paul Moore 写道:
> > On Wed, Jul 13, 2022 at 9:27 PM Xiu Jianfeng <xiujianfeng@huawei.com> wrote:
> >> The implements of {ip,tcp,udp,dccp,sctp,ipv6}_hdr(skb) guarantee that
> >> they will never return NULL, and elsewhere users don't do the check
> >> as well, so remove the check here.
> >>
> >> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> >> ---
> >>   security/lsm_audit.c | 14 +-------------
> >>   1 file changed, 1 insertion(+), 13 deletions(-)
> > Hi Xiu Jianfeng,
> >
> > We just changed LSM maintainers earlier this week, and while I haven't
> > forgotten about your patch (I reviewed it previously), it is too late
> > in this current release cycle (-rc6) to merge non-critical fixes.
> > This would go into the LSM tree after the upcoming merge window.
> >
> > Thank you for your patience and understanding.
>
> Hi, paul, I get it, thanks very much :)

I just merged this into the lsm/next branch, thanks for your patience.

-- 
paul-moore.com

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

end of thread, other threads:[~2022-08-16  7:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14  1:24 [PATCH RESEND -next] lsm_audit: Clean up redundant NULL pointer check Xiu Jianfeng
2022-07-14  2:33 ` Paul Moore
2022-07-14  2:48   ` xiujianfeng
2022-08-16  2:27     ` Paul Moore

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.