* [PATCH] ethernet: neterion: vxge: vxge-traffic.c: fix for a potential NULL pointer dereference
@ 2013-02-16 17:56 Kumar Amit Mehta
2013-02-17 14:49 ` walter harms
2013-02-18 19:45 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Kumar Amit Mehta @ 2013-02-16 17:56 UTC (permalink / raw)
To: jdmason; +Cc: davem, joe, netdev, linux-kernel, kernel-janitors
fix for a potential NULL pointer dereference and removal of a redundant
assignment operation. Found using smatch.
Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
---
drivers/net/ethernet/neterion/vxge/vxge-traffic.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-traffic.c b/drivers/net/ethernet/neterion/vxge/vxge-traffic.c
index 99749bd..adb05a8 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-traffic.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-traffic.c
@@ -611,11 +611,8 @@ __vxge_hw_vpath_alarm_process(struct __vxge_hw_virtualpath *vpath,
struct vxge_hw_vpath_stats_sw_info *sw_stats;
struct vxge_hw_vpath_reg __iomem *vp_reg;
- if (vpath == NULL) {
- alarm_event = VXGE_HW_SET_LEVEL(VXGE_HW_EVENT_UNKNOWN,
- alarm_event);
+ if (vpath == NULL)
goto out2;
- }
hldev = vpath->hldev;
vp_reg = vpath->vp_reg;
@@ -852,13 +849,12 @@ __vxge_hw_vpath_alarm_process(struct __vxge_hw_virtualpath *vpath,
}
out:
hldev->stats.sw_dev_err_stats.vpath_alarms++;
+ __vxge_hw_device_handle_error(hldev, vpath->vp_id, alarm_event);
out2:
if ((alarm_event == VXGE_HW_EVENT_ALARM_CLEARED) ||
(alarm_event == VXGE_HW_EVENT_UNKNOWN))
return VXGE_HW_OK;
- __vxge_hw_device_handle_error(hldev, vpath->vp_id, alarm_event);
-
if (alarm_event == VXGE_HW_EVENT_SERR)
return VXGE_HW_ERR_CRITICAL;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ethernet: neterion: vxge: vxge-traffic.c: fix for a potential NULL pointer dereference
2013-02-16 17:56 [PATCH] ethernet: neterion: vxge: vxge-traffic.c: fix for a potential NULL pointer dereference Kumar Amit Mehta
@ 2013-02-17 14:49 ` walter harms
2013-02-18 19:45 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: walter harms @ 2013-02-17 14:49 UTC (permalink / raw)
To: Kumar Amit Mehta
Cc: jdmason, davem, joe, netdev, linux-kernel, kernel-janitors
Am 16.02.2013 18:56, schrieb Kumar Amit Mehta:
> fix for a potential NULL pointer dereference and removal of a redundant
> assignment operation. Found using smatch.
>
> Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
> ---
> drivers/net/ethernet/neterion/vxge/vxge-traffic.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/neterion/vxge/vxge-traffic.c b/drivers/net/ethernet/neterion/vxge/vxge-traffic.c
> index 99749bd..adb05a8 100644
> --- a/drivers/net/ethernet/neterion/vxge/vxge-traffic.c
> +++ b/drivers/net/ethernet/neterion/vxge/vxge-traffic.c
> @@ -611,11 +611,8 @@ __vxge_hw_vpath_alarm_process(struct __vxge_hw_virtualpath *vpath,
> struct vxge_hw_vpath_stats_sw_info *sw_stats;
> struct vxge_hw_vpath_reg __iomem *vp_reg;
>
> - if (vpath == NULL) {
> - alarm_event = VXGE_HW_SET_LEVEL(VXGE_HW_EVENT_UNKNOWN,
> - alarm_event);
> + if (vpath == NULL)
> goto out2;
> - }
>
> hldev = vpath->hldev;
> vp_reg = vpath->vp_reg;
> @@ -852,13 +849,12 @@ __vxge_hw_vpath_alarm_process(struct __vxge_hw_virtualpath *vpath,
> }
> out:
> hldev->stats.sw_dev_err_stats.vpath_alarms++;
> + __vxge_hw_device_handle_error(hldev, vpath->vp_id, alarm_event);
> out2:
> if ((alarm_event == VXGE_HW_EVENT_ALARM_CLEARED) ||
> (alarm_event == VXGE_HW_EVENT_UNKNOWN))
> return VXGE_HW_OK;
>
> - __vxge_hw_device_handle_error(hldev, vpath->vp_id, alarm_event);
> -
> if (alarm_event == VXGE_HW_EVENT_SERR)
> return VXGE_HW_ERR_CRITICAL;
>
the patch looks ok.
it would be nice if someone would rewrite the if (alarm_event == x ) stuff
using switch or more if()'s it is hardly readable this way.
just my 2 cents,
re,
wh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ethernet: neterion: vxge: vxge-traffic.c: fix for a potential NULL pointer dereference
2013-02-16 17:56 [PATCH] ethernet: neterion: vxge: vxge-traffic.c: fix for a potential NULL pointer dereference Kumar Amit Mehta
2013-02-17 14:49 ` walter harms
@ 2013-02-18 19:45 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-02-18 19:45 UTC (permalink / raw)
To: gmate.amit; +Cc: jdmason, joe, netdev, linux-kernel, kernel-janitors
From: Kumar Amit Mehta <gmate.amit@gmail.com>
Date: Sat, 16 Feb 2013 09:56:34 -0800
> fix for a potential NULL pointer dereference and removal of a redundant
> assignment operation. Found using smatch.
>
> Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
Obviously whoever wrote this code intended for ALARM_CLEARED
and EVENT_UNKNOWN events to not be logged.
But you're changing that.
I'm not applying this patch, sorry.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-18 19:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-16 17:56 [PATCH] ethernet: neterion: vxge: vxge-traffic.c: fix for a potential NULL pointer dereference Kumar Amit Mehta
2013-02-17 14:49 ` walter harms
2013-02-18 19:45 ` David Miller
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).