From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752891AbdC2PtB (ORCPT ); Wed, 29 Mar 2017 11:49:01 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:36593 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752256AbdC2Psb (ORCPT ); Wed, 29 Mar 2017 11:48:31 -0400 MIME-Version: 1.0 X-Originating-IP: [108.49.102.27] In-Reply-To: References: From: Paul Moore Date: Wed, 29 Mar 2017 11:48:29 -0400 Message-ID: Subject: Re: [PATCH 44/46] selinux: Adjust two checks for null pointers To: SF Markus Elfring Cc: linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Eric Paris , James Morris , "Serge E. Hallyn" , Stephen Smalley , William Roberts , LKML , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v2TFn5Jt028977 On Sun, Jan 15, 2017 at 10:44 AM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 15 Jan 2017 13:30:20 +0100 > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > The script "checkpatch.pl" pointed information out like the following. > > Comparison to NULL could be written !… > > Thus fix affected source code places. > > Signed-off-by: Markus Elfring > --- > security/selinux/ss/sidtab.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Merged. Definitely code churn, but arguably there is some minor value in making checkpatch.pl happy. In the future changes like this should be bundled with more significant changes to make them more appealing. > diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c > index c9533b21942b..f6915f257486 100644 > --- a/security/selinux/ss/sidtab.c > +++ b/security/selinux/ss/sidtab.c > @@ -54,7 +54,7 @@ int sidtab_insert(struct sidtab *s, u32 sid, struct context *context) > } > > newnode = kmalloc(sizeof(*newnode), GFP_ATOMIC); > - if (newnode == NULL) { > + if (!newnode) { > rc = -ENOMEM; > goto out; > } > @@ -98,7 +98,7 @@ static struct context *sidtab_search_core(struct sidtab *s, u32 sid, int force) > if (force && cur && sid == cur->sid && cur->context.len) > return &cur->context; > > - if (cur == NULL || sid != cur->sid || cur->context.len) { > + if (!cur || sid != cur->sid || cur->context.len) { > /* Remap invalid SIDs to the unlabeled SID. */ > sid = SECINITSID_UNLABELED; > hvalue = SIDTAB_HASH(sid); > -- > 2.11.0 > -- paul moore www.paul-moore.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Moore Date: Wed, 29 Mar 2017 15:48:29 +0000 Subject: Re: [PATCH 44/46] selinux: Adjust two checks for null pointers Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: linux-security-module@vger.kernel.org On Sun, Jan 15, 2017 at 10:44 AM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 15 Jan 2017 13:30:20 +0100 > MIME-Version: 1.0 > Content-Type: text/plain; charset=3DUTF-8 > Content-Transfer-Encoding: 8bit > > The script "checkpatch.pl" pointed information out like the following. > > Comparison to NULL could be written !=E2=80=A6 > > Thus fix affected source code places. > > Signed-off-by: Markus Elfring > --- > security/selinux/ss/sidtab.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Merged. Definitely code churn, but arguably there is some minor value in making checkpatch.pl happy. In the future changes like this should be bundled with more significant changes to make them more appealing. > diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c > index c9533b21942b..f6915f257486 100644 > --- a/security/selinux/ss/sidtab.c > +++ b/security/selinux/ss/sidtab.c > @@ -54,7 +54,7 @@ int sidtab_insert(struct sidtab *s, u32 sid, struct con= text *context) > } > > newnode =3D kmalloc(sizeof(*newnode), GFP_ATOMIC); > - if (newnode =3D=3D NULL) { > + if (!newnode) { > rc =3D -ENOMEM; > goto out; > } > @@ -98,7 +98,7 @@ static struct context *sidtab_search_core(struct sidtab= *s, u32 sid, int force) > if (force && cur && sid =3D=3D cur->sid && cur->context.len) > return &cur->context; > > - if (cur =3D=3D NULL || sid !=3D cur->sid || cur->context.len) { > + if (!cur || sid !=3D cur->sid || cur->context.len) { > /* Remap invalid SIDs to the unlabeled SID. */ > sid =3D SECINITSID_UNLABELED; > hvalue =3D SIDTAB_HASH(sid); > -- > 2.11.0 > --=20 paul moore www.paul-moore.com -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: paul@paul-moore.com (Paul Moore) Date: Wed, 29 Mar 2017 11:48:29 -0400 Subject: [PATCH 44/46] selinux: Adjust two checks for null pointers In-Reply-To: References: Message-ID: To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org On Sun, Jan 15, 2017 at 10:44 AM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 15 Jan 2017 13:30:20 +0100 > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > The script "checkpatch.pl" pointed information out like the following. > > Comparison to NULL could be written !? > > Thus fix affected source code places. > > Signed-off-by: Markus Elfring > --- > security/selinux/ss/sidtab.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Merged. Definitely code churn, but arguably there is some minor value in making checkpatch.pl happy. In the future changes like this should be bundled with more significant changes to make them more appealing. > diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c > index c9533b21942b..f6915f257486 100644 > --- a/security/selinux/ss/sidtab.c > +++ b/security/selinux/ss/sidtab.c > @@ -54,7 +54,7 @@ int sidtab_insert(struct sidtab *s, u32 sid, struct context *context) > } > > newnode = kmalloc(sizeof(*newnode), GFP_ATOMIC); > - if (newnode == NULL) { > + if (!newnode) { > rc = -ENOMEM; > goto out; > } > @@ -98,7 +98,7 @@ static struct context *sidtab_search_core(struct sidtab *s, u32 sid, int force) > if (force && cur && sid == cur->sid && cur->context.len) > return &cur->context; > > - if (cur == NULL || sid != cur->sid || cur->context.len) { > + if (!cur || sid != cur->sid || cur->context.len) { > /* Remap invalid SIDs to the unlabeled SID. */ > sid = SECINITSID_UNLABELED; > hvalue = SIDTAB_HASH(sid); > -- > 2.11.0 > -- paul moore www.paul-moore.com -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html