public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	devel@driverdev.osuosl.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Brilliantov Kirill Vladimirovich <brilliantov@inbox.ru>,
	linux-kernel@vger.kernel.org, HPDD-discuss@ml01.01.org,
	Greg Donald <gdonald@gmail.com>
Subject: Re: [PATCH] staging: lustre: lustre: osc: lproc_osc.c: Fix for possible null pointer dereference
Date: Mon, 15 Dec 2014 13:25:02 +0300	[thread overview]
Message-ID: <20141215102502.GB4856@mwanda> (raw)
In-Reply-To: <1418596638-24646-1-git-send-email-rickard_strandqvist@spectrumdigital.se>

On Sun, Dec 14, 2014 at 11:37:18PM +0100, Rickard Strandqvist wrote:
> There is otherwise a risk of a possible null pointer dereference.
> 
> Was largely found by using a static code analysis program called cppcheck.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>  drivers/staging/lustre/lustre/osc/lproc_osc.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c
> index 9f719bc..9ba6293 100644
> --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
> +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
> @@ -237,13 +237,15 @@ static ssize_t osc_cur_grant_bytes_seq_write(struct file *file, const char *buff
>  				  size_t count, loff_t *off)
>  {
>  	struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
> -	struct client_obd *cli = &obd->u.cli;
> +	struct client_obd *cli;

This isn't really a dereference.  You're just getting the address of
obd->u.cli.  So if obd is NULL then it won't crash.

regards,
dan carpenter


  reply	other threads:[~2014-12-15 10:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-14 22:37 [PATCH] staging: lustre: lustre: osc: lproc_osc.c: Fix for possible null pointer dereference Rickard Strandqvist
2014-12-15 10:25 ` Dan Carpenter [this message]
2014-12-15 23:07   ` Rickard Strandqvist
2014-12-16  9:26     ` 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=20141215102502.GB4856@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=HPDD-discuss@ml01.01.org \
    --cc=andreas.dilger@intel.com \
    --cc=brilliantov@inbox.ru \
    --cc=devel@driverdev.osuosl.org \
    --cc=gdonald@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    --cc=rickard_strandqvist@spectrumdigital.se \
    /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