public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Hugues <morisset.hugues@gmail.com>, Oleg Drokin <oleg.drokin@intel.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org,
	Andreas Dilger <andreas.dilger@intel.com>
Subject: Re: [PATCH 4/4] staging: lustre: Fix potential buffer underflow
Date: Tue, 9 Sep 2014 01:38:53 +0300	[thread overview]
Message-ID: <20140908223853.GN6600@mwanda> (raw)
In-Reply-To: <540E29B1.6090005@gmail.com>

On Tue, Sep 09, 2014 at 12:12:01AM +0200, Hugues wrote:
> Fix potential buffer underflow
> 
> When the string 'name' start with a '-' ptr == name and so --ptr will
> underflow, this patch corrected this by checking ptr before decrementing.

Good eye.  Please fix up the changelog and send it inline etc and
resend.  I've added Oleg and Andreas to the CC list so that this doesn't
get lost.

regards,
dan carpenter

> >From 5786040323bd1dc3149fb4afbea9f01e2bf4cfdf Mon Sep 17 00:00:00 2001
> From: Hugues Morisset <morisset.hugues@gmail.com>
> Date: Mon, 8 Sep 2014 22:59:04 +0200
> Subject: [PATCH 4/4] staging: lustre: Fix potential buffer underflow
> 
> Signed-off-by: Hugues Morisset <morisset.hugues@gmail.com>
> ---
>  drivers/staging/lustre/lustre/include/obd.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
> index 409eae6..bb67e40 100644
> --- a/drivers/staging/lustre/lustre/include/obd.h
> +++ b/drivers/staging/lustre/lustre/include/obd.h
> @@ -677,7 +677,12 @@ static inline int is_osp_on_mdt(char *name)
>  	if (strncmp(ptr + 1, "MDT", 3) != 0)
>  		return 0;
>  
> -	while (*(--ptr) != '-' && ptr != name);
> +	if (ptr == name)
> +		return 0;
> +
> +	--ptr;
> +	while (ptr != '-' && ptr != name)
> +		--ptr;
>  
>  	if (ptr == name)
>  		return 0;
> -- 
> 2.1.0
> 

> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


  reply	other threads:[~2014-09-08 22:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 22:04 [PATCH 1/4] staging: lustre: fix coding style issues Hugues
2014-09-08 22:06 ` [PATCH 2/4] " Hugues
2014-09-08 22:07   ` [PATCH 3/4] " Hugues
2014-09-08 22:09     ` Hugues
2014-09-08 22:12     ` [PATCH 4/4] staging: lustre: Fix potential buffer underflow Hugues
2014-09-08 22:38       ` Dan Carpenter [this message]
2014-09-08 23:31         ` Drokin, Oleg
2014-09-08 22:13 ` [PATCH 1/4] staging: lustre: fix coding style issues Greg KH
2014-09-08 22:21 ` Dan Carpenter

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=20140908223853.GN6600@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morisset.hugues@gmail.com \
    --cc=oleg.drokin@intel.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