* [PATCH] IB/core: Fix static analysis warning in ib_policy_change_task
@ 2017-06-30 15:15 Dan Jurgens
[not found] ` <1498835756-7610-1-git-send-email-danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Dan Jurgens @ 2017-06-30 15:15 UTC (permalink / raw)
To: paul-r2n+y4ga6xFZroRs9YW3xA, dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: selinux-+05T5uksL2qpZYMLLGbcSA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
yevgenyp-VPRAkNaXOzVWk0Htik3J/w, Daniel Jurgens
From: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
ib_get_cached_subnet_prefix can technically fail, but the only way it
could is not possible based on the loop conditions. Check the return
value before using the variable sp to resolve a static analysis warning.
Fixes: 8f408ab64be6 ("selinux lsm IB/core: Implement LSM notification
system")
Signed-off-by: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
drivers/infiniband/core/device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 631eaa9..dabd9f9 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -376,7 +376,8 @@ static void ib_policy_change_task(struct work_struct *work)
WARN_ONCE(ret,
"ib_get_cached_subnet_prefix err: %d, this should never happen here\n",
ret);
- ib_security_cache_change(dev, i, sp);
+ if (ret)
+ ib_security_cache_change(dev, i, sp);
}
}
up_read(&lists_rwsem);
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <1498835756-7610-1-git-send-email-danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH] IB/core: Fix static analysis warning in ib_policy_change_task [not found] ` <1498835756-7610-1-git-send-email-danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> @ 2017-07-01 13:42 ` Paul Moore [not found] ` <CAHC9VhQC4VO2W6TCOWxKdfsra=fG12ZYXaJdKQJVXtLz92XtoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-07-03 23:03 ` Paul Moore 1 sibling, 1 reply; 6+ messages in thread From: Paul Moore @ 2017-07-01 13:42 UTC (permalink / raw) To: Dan Jurgens, linux-rdma-u79uwXL29TY76Z2rM5mHXA Cc: dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA, dledford-H+wXaHxf7aLQT0dZR+AlfA, selinux-+05T5uksL2qpZYMLLGbcSA, yevgenyp-VPRAkNaXOzVWk0Htik3J/w On Fri, Jun 30, 2017 at 11:15 AM, Dan Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote: > From: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > > ib_get_cached_subnet_prefix can technically fail, but the only way it > could is not possible based on the loop conditions. Check the return > value before using the variable sp to resolve a static analysis warning. > > Fixes: 8f408ab64be6 ("selinux lsm IB/core: Implement LSM notification > system") > Signed-off-by: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > --- > drivers/infiniband/core/device.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Similar question as with the other fix: SELinux tree or IB/RDMA tree? -- paul moore www.paul-moore.com -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAHC9VhQC4VO2W6TCOWxKdfsra=fG12ZYXaJdKQJVXtLz92XtoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] IB/core: Fix static analysis warning in ib_policy_change_task [not found] ` <CAHC9VhQC4VO2W6TCOWxKdfsra=fG12ZYXaJdKQJVXtLz92XtoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-07-01 19:41 ` Doug Ledford 0 siblings, 0 replies; 6+ messages in thread From: Doug Ledford @ 2017-07-01 19:41 UTC (permalink / raw) To: Paul Moore, Dan Jurgens, linux-rdma-u79uwXL29TY76Z2rM5mHXA Cc: dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA, selinux-+05T5uksL2qpZYMLLGbcSA, yevgenyp-VPRAkNaXOzVWk0Htik3J/w [-- Attachment #1.1: Type: text/plain, Size: 1122 bytes --] On 7/1/2017 9:42 AM, Paul Moore wrote: > On Fri, Jun 30, 2017 at 11:15 AM, Dan Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote: >> From: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> >> >> ib_get_cached_subnet_prefix can technically fail, but the only way it >> could is not possible based on the loop conditions. Check the return >> value before using the variable sp to resolve a static analysis warning. >> >> Fixes: 8f408ab64be6 ("selinux lsm IB/core: Implement LSM notification >> system") >> Signed-off-by: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> >> Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> >> --- >> drivers/infiniband/core/device.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) > > Similar question as with the other fix: SELinux tree or IB/RDMA tree? > The SELinux tree will be fine with me. -- Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> GPG Key ID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 884 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/core: Fix static analysis warning in ib_policy_change_task [not found] ` <1498835756-7610-1-git-send-email-danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> 2017-07-01 13:42 ` Paul Moore @ 2017-07-03 23:03 ` Paul Moore [not found] ` <CAHC9VhQcSfuMxZoAiTW8c-MNf6m0gLk_xArC7HkjR+5ZJgtgPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: Paul Moore @ 2017-07-03 23:03 UTC (permalink / raw) To: Dan Jurgens Cc: dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA, dledford-H+wXaHxf7aLQT0dZR+AlfA, selinux-+05T5uksL2qpZYMLLGbcSA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, yevgenyp-VPRAkNaXOzVWk0Htik3J/w On Fri, Jun 30, 2017 at 11:15 AM, Dan Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote: > From: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > > ib_get_cached_subnet_prefix can technically fail, but the only way it > could is not possible based on the loop conditions. Check the return > value before using the variable sp to resolve a static analysis warning. > > Fixes: 8f408ab64be6 ("selinux lsm IB/core: Implement LSM notification > system") > Signed-off-by: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > --- > drivers/infiniband/core/device.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c > index 631eaa9..dabd9f9 100644 > --- a/drivers/infiniband/core/device.c > +++ b/drivers/infiniband/core/device.c > @@ -376,7 +376,8 @@ static void ib_policy_change_task(struct work_struct *work) > WARN_ONCE(ret, > "ib_get_cached_subnet_prefix err: %d, this should never happen here\n", > ret); > - ib_security_cache_change(dev, i, sp); > + if (ret) Should this be "if (!ret)"? > + ib_security_cache_change(dev, i, sp); > } > } > up_read(&lists_rwsem); -- paul moore www.paul-moore.com -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAHC9VhQcSfuMxZoAiTW8c-MNf6m0gLk_xArC7HkjR+5ZJgtgPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] IB/core: Fix static analysis warning in ib_policy_change_task [not found] ` <CAHC9VhQcSfuMxZoAiTW8c-MNf6m0gLk_xArC7HkjR+5ZJgtgPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-07-04 6:34 ` Leon Romanovsky 2017-07-05 13:16 ` Daniel Jurgens 1 sibling, 0 replies; 6+ messages in thread From: Leon Romanovsky @ 2017-07-04 6:34 UTC (permalink / raw) To: Paul Moore Cc: Dan Jurgens, dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA, dledford-H+wXaHxf7aLQT0dZR+AlfA, selinux-+05T5uksL2qpZYMLLGbcSA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, yevgenyp-VPRAkNaXOzVWk0Htik3J/w [-- Attachment #1: Type: text/plain, Size: 1911 bytes --] On Mon, Jul 03, 2017 at 07:03:54PM -0400, Paul Moore wrote: > On Fri, Jun 30, 2017 at 11:15 AM, Dan Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote: > > From: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > > > > ib_get_cached_subnet_prefix can technically fail, but the only way it > > could is not possible based on the loop conditions. Check the return > > value before using the variable sp to resolve a static analysis warning. > > > > Fixes: 8f408ab64be6 ("selinux lsm IB/core: Implement LSM notification > > system") > > Signed-off-by: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > > Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > > --- > > drivers/infiniband/core/device.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c > > index 631eaa9..dabd9f9 100644 > > --- a/drivers/infiniband/core/device.c > > +++ b/drivers/infiniband/core/device.c > > @@ -376,7 +376,8 @@ static void ib_policy_change_task(struct work_struct *work) > > WARN_ONCE(ret, > > "ib_get_cached_subnet_prefix err: %d, this should never happen here\n", > > ret); > > - ib_security_cache_change(dev, i, sp); > > + if (ret) > > Should this be "if (!ret)"? You are right, It should. Thanks > > > + ib_security_cache_change(dev, i, sp); > > } > > } > > up_read(&lists_rwsem); > > -- > paul moore > www.paul-moore.com > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/core: Fix static analysis warning in ib_policy_change_task [not found] ` <CAHC9VhQcSfuMxZoAiTW8c-MNf6m0gLk_xArC7HkjR+5ZJgtgPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-07-04 6:34 ` Leon Romanovsky @ 2017-07-05 13:16 ` Daniel Jurgens 1 sibling, 0 replies; 6+ messages in thread From: Daniel Jurgens @ 2017-07-05 13:16 UTC (permalink / raw) To: Paul Moore Cc: dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA, dledford-H+wXaHxf7aLQT0dZR+AlfA, selinux-+05T5uksL2qpZYMLLGbcSA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, yevgenyp-VPRAkNaXOzVWk0Htik3J/w On 7/3/2017 6:03 PM, Paul Moore wrote: > On Fri, Jun 30, 2017 at 11:15 AM, Dan Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote: >> From: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> >> >> ib_get_cached_subnet_prefix can technically fail, but the only way it >> could is not possible based on the loop conditions. Check the return >> value before using the variable sp to resolve a static analysis warning. >> >> Fixes: 8f408ab64be6 ("selinux lsm IB/core: Implement LSM notification >> system") >> Signed-off-by: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> >> Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> >> --- >> drivers/infiniband/core/device.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c >> index 631eaa9..dabd9f9 100644 >> --- a/drivers/infiniband/core/device.c >> +++ b/drivers/infiniband/core/device.c >> @@ -376,7 +376,8 @@ static void ib_policy_change_task(struct work_struct *work) >> WARN_ONCE(ret, >> "ib_get_cached_subnet_prefix err: %d, this should never happen here\n", >> ret); >> - ib_security_cache_change(dev, i, sp); >> + if (ret) > Should this be "if (!ret)"? Yes, my apologies. I missed the git add after fixing that locally. I sent v1 a minute ago. > >> + ib_security_cache_change(dev, i, sp); >> } >> } >> up_read(&lists_rwsem); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-07-05 13:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-30 15:15 [PATCH] IB/core: Fix static analysis warning in ib_policy_change_task Dan Jurgens
[not found] ` <1498835756-7610-1-git-send-email-danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-07-01 13:42 ` Paul Moore
[not found] ` <CAHC9VhQC4VO2W6TCOWxKdfsra=fG12ZYXaJdKQJVXtLz92XtoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-01 19:41 ` Doug Ledford
2017-07-03 23:03 ` Paul Moore
[not found] ` <CAHC9VhQcSfuMxZoAiTW8c-MNf6m0gLk_xArC7HkjR+5ZJgtgPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-04 6:34 ` Leon Romanovsky
2017-07-05 13:16 ` Daniel Jurgens
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox