netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: "Roel Kluin" <roel.kluin@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	davem@davemloft.net
Subject: Re: [PATCH] cnic: ensure ulp_type is not negative
Date: Mon, 2 Nov 2009 09:56:59 -0800	[thread overview]
Message-ID: <1257184619.31958.3.camel@HP1> (raw)
In-Reply-To: <4AEF0E98.5050304@gmail.com>


On Mon, 2009-11-02 at 08:53 -0800, Roel Kluin wrote:
> `ulp_type' is signed, make sure it is not negative
> when we read the array element.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Looks good to me.  Thanks.
Acked-by: Michael Chan <mchan@broadcom.com>

> ---
>  drivers/net/cnic.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
> index 3bf1b04..f384b0a 100644
> --- a/drivers/net/cnic.c
> +++ b/drivers/net/cnic.c
> @@ -347,7 +347,7 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
>  {
>  	struct cnic_dev *dev;
>  
> -	if (ulp_type >= MAX_CNIC_ULP_TYPE) {
> +	if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
>  		printk(KERN_ERR PFX "cnic_register_driver: Bad type %d\n",
>  		       ulp_type);
>  		return -EINVAL;
> @@ -393,7 +393,7 @@ int cnic_unregister_driver(int ulp_type)
>  	struct cnic_ulp_ops *ulp_ops;
>  	int i = 0;
>  
> -	if (ulp_type >= MAX_CNIC_ULP_TYPE) {
> +	if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
>  		printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n",
>  		       ulp_type);
>  		return -EINVAL;
> @@ -449,7 +449,7 @@ static int cnic_register_device(struct cnic_dev *dev, int ulp_type,
>  	struct cnic_local *cp = dev->cnic_priv;
>  	struct cnic_ulp_ops *ulp_ops;
>  
> -	if (ulp_type >= MAX_CNIC_ULP_TYPE) {
> +	if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
>  		printk(KERN_ERR PFX "cnic_register_device: Bad type %d\n",
>  		       ulp_type);
>  		return -EINVAL;
> @@ -490,7 +490,7 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
>  	struct cnic_local *cp = dev->cnic_priv;
>  	int i = 0;
>  
> -	if (ulp_type >= MAX_CNIC_ULP_TYPE) {
> +	if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
>  		printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n",
>  		       ulp_type);
>  		return -EINVAL;
> 

  reply	other threads:[~2009-11-02 17:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-02 16:53 [PATCH] cnic: ensure ulp_type is not negative Roel Kluin
2009-11-02 17:56 ` Michael Chan [this message]
2009-11-04 13:07   ` 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=1257184619.31958.3.camel@HP1 \
    --to=mchan@broadcom.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    /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).