All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Sakari Ailus <sakari.ailus@iki.fi>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Colin King <colin.king@canonical.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] media: ispstat: don't dereference user_cfg before a null check
Date: Mon, 30 Apr 2018 10:26:25 -0500	[thread overview]
Message-ID: <9c1e7c1e-c391-4b91-7836-61a8b9d5489a@embeddedor.com> (raw)
In-Reply-To: <20180430151503.d3kq2zomil6uh2xf@valkosipuli.retiisi.org.uk>

Hi Sakari,

On 04/30/2018 10:15 AM, Sakari Ailus wrote:
>> Isn't there a guarantee that new_buf won't be NULL ? The new_buf pointer comes
>> from the parg variable in video_usercopy(), which should always point to a
>> valid buffer given that the ioctl number specifies a non-zero size.
> 
> Fair question. After looking at the code, I agree with you; there should be
> no reason to perform the check in the first place. It may have been that
> the function has been used differently in the past but the check should be
> rather removed now.
> 
> I'll drop the patch.
> 

Please, if the check isn't needed anymore, make sure it is removed.

This helps to reduce the number of false positives reported by static 
analyzers.

Thanks
--
Gustavo

WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Sakari Ailus <sakari.ailus@iki.fi>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Colin King <colin.king@canonical.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] media: ispstat: don't dereference user_cfg before a null check
Date: Mon, 30 Apr 2018 15:26:25 +0000	[thread overview]
Message-ID: <9c1e7c1e-c391-4b91-7836-61a8b9d5489a@embeddedor.com> (raw)
In-Reply-To: <20180430151503.d3kq2zomil6uh2xf@valkosipuli.retiisi.org.uk>

Hi Sakari,

On 04/30/2018 10:15 AM, Sakari Ailus wrote:
>> Isn't there a guarantee that new_buf won't be NULL ? The new_buf pointer comes
>> from the parg variable in video_usercopy(), which should always point to a
>> valid buffer given that the ioctl number specifies a non-zero size.
> 
> Fair question. After looking at the code, I agree with you; there should be
> no reason to perform the check in the first place. It may have been that
> the function has been used differently in the past but the check should be
> rather removed now.
> 
> I'll drop the patch.
> 

Please, if the check isn't needed anymore, make sure it is removed.

This helps to reduce the number of false positives reported by static 
analyzers.

Thanks
--
Gustavo

  reply	other threads:[~2018-04-30 15:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-24 13:06 [PATCH][next] media: ispstat: don't dereference user_cfg before a null check Colin King
2018-04-24 13:06 ` Colin King
2018-04-26  8:37 ` Sakari Ailus
2018-04-26  8:37   ` Sakari Ailus
2018-04-26 10:03   ` Laurent Pinchart
2018-04-26 10:03     ` Laurent Pinchart
2018-04-30 15:15     ` Sakari Ailus
2018-04-30 15:15       ` Sakari Ailus
2018-04-30 15:26       ` Gustavo A. R. Silva [this message]
2018-04-30 15:26         ` Gustavo A. R. Silva

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=9c1e7c1e-c391-4b91-7836-61a8b9d5489a@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.