netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Kumar Amit Mehta <gmate.amit@gmail.com>
Cc: jdmason@kudzu.us, davem@davemloft.net, joe@perches.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ethernet: neterion: vxge: vxge-traffic.c: fix for a potential NULL pointer dereference
Date: Sun, 17 Feb 2013 15:49:28 +0100	[thread overview]
Message-ID: <5120EDF8.7010503@bfs.de> (raw)
In-Reply-To: <1361037394-14731-1-git-send-email-gmate.amit@gmail.com>



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

  reply	other threads:[~2013-02-17 14:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-02-18 19:45 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5120EDF8.7010503@bfs.de \
    --to=wharms@bfs.de \
    --cc=davem@davemloft.net \
    --cc=gmate.amit@gmail.com \
    --cc=jdmason@kudzu.us \
    --cc=joe@perches.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).