[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141215102502.GB4856@mwanda>
Date: Mon, 15 Dec 2014 13:25:02 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: Oleg Drokin <oleg.drokin@...el.com>,
Andreas Dilger <andreas.dilger@...el.com>,
devel@...verdev.osuosl.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Brilliantov Kirill Vladimirovich <brilliantov@...ox.ru>,
linux-kernel@...r.kernel.org, HPDD-discuss@...1.01.org,
Greg Donald <gdonald@...il.com>
Subject: Re: [PATCH] staging: lustre: lustre: osc: lproc_osc.c: Fix for
possible null pointer dereference
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@...ctrumdigital.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists