All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Cc: Kukjin Kim <kgene@kernel.org>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-samsung-soc@vger.kernel.org>
Subject: Re: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
Date: Thu, 26 May 2016 11:29:14 +0530	[thread overview]
Message-ID: <574690B2.9010204@ti.com> (raw)
In-Reply-To: <14219690.YQPrXjp7cP@wuerfel>

Hi Arnd,

On Thursday 26 May 2016 12:24 AM, Arnd Bergmann wrote:
> On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote:
>> On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
>>> A rework of the exynos-mipi-video driver caused a warning
>>> about the new __set_phy_state function potentially accessing
>>> a variable before its initialization:
>>>
>>> drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
>>> drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>>   return val & data->resetn_val;
>>>          ~~~~^~~~~~~~~~~~~~~~~~
>>> drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
>>>   u32 val;
>>>
>>> The failure scenario here is the offset passed into a the
>>> stub regmap_read() function that does not modify its output,
>>> however regmap_read() can also fail for other reasons, so
>>> adding error handling (in this case, returning zero from
>>> is_running) seems the best solution.
>>>
>>> Note that this warning showed up with the ARM s5pv210_defconfig,
>>> indicating that we most likely want to either enable CONFIG_REGMAP
>>> in that defconfig as well, or disable the phy-exynos-mipi-video
>>> driver.
>>>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
>>> ---
>>>  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
>>> index cc093ebfda94..8b851f718123 100644
>>> --- a/drivers/phy/phy-exynos-mipi-video.c
>>> +++ b/drivers/phy/phy-exynos-mipi-video.c
>>> @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
>>>                       struct exynos_mipi_video_phy *state)
>>>  {
>>>       u32 val;
>>
>> Other way would be to initialize val=0 since there is no real error code
>> returned. Anyway:
>>
>> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> 
> This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2?

Not in -rc1. Mostly it'll go in -rc2. Generally I start queuing patches after
-rc1 is tagged.

Thanks
Kishon

WARNING: multiple messages have this Message-ID (diff)
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Cc: Kukjin Kim <kgene@kernel.org>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
Date: Thu, 26 May 2016 11:29:14 +0530	[thread overview]
Message-ID: <574690B2.9010204@ti.com> (raw)
In-Reply-To: <14219690.YQPrXjp7cP@wuerfel>

Hi Arnd,

On Thursday 26 May 2016 12:24 AM, Arnd Bergmann wrote:
> On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote:
>> On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
>>> A rework of the exynos-mipi-video driver caused a warning
>>> about the new __set_phy_state function potentially accessing
>>> a variable before its initialization:
>>>
>>> drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
>>> drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>>   return val & data->resetn_val;
>>>          ~~~~^~~~~~~~~~~~~~~~~~
>>> drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
>>>   u32 val;
>>>
>>> The failure scenario here is the offset passed into a the
>>> stub regmap_read() function that does not modify its output,
>>> however regmap_read() can also fail for other reasons, so
>>> adding error handling (in this case, returning zero from
>>> is_running) seems the best solution.
>>>
>>> Note that this warning showed up with the ARM s5pv210_defconfig,
>>> indicating that we most likely want to either enable CONFIG_REGMAP
>>> in that defconfig as well, or disable the phy-exynos-mipi-video
>>> driver.
>>>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
>>> ---
>>>  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
>>> index cc093ebfda94..8b851f718123 100644
>>> --- a/drivers/phy/phy-exynos-mipi-video.c
>>> +++ b/drivers/phy/phy-exynos-mipi-video.c
>>> @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
>>>                       struct exynos_mipi_video_phy *state)
>>>  {
>>>       u32 val;
>>
>> Other way would be to initialize val=0 since there is no real error code
>> returned. Anyway:
>>
>> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> 
> This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2?

Not in -rc1. Mostly it'll go in -rc2. Generally I start queuing patches after
-rc1 is tagged.

Thanks
Kishon

WARNING: multiple messages have this Message-ID (diff)
From: kishon@ti.com (Kishon Vijay Abraham I)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
Date: Thu, 26 May 2016 11:29:14 +0530	[thread overview]
Message-ID: <574690B2.9010204@ti.com> (raw)
In-Reply-To: <14219690.YQPrXjp7cP@wuerfel>

Hi Arnd,

On Thursday 26 May 2016 12:24 AM, Arnd Bergmann wrote:
> On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote:
>> On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
>>> A rework of the exynos-mipi-video driver caused a warning
>>> about the new __set_phy_state function potentially accessing
>>> a variable before its initialization:
>>>
>>> drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
>>> drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>>   return val & data->resetn_val;
>>>          ~~~~^~~~~~~~~~~~~~~~~~
>>> drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
>>>   u32 val;
>>>
>>> The failure scenario here is the offset passed into a the
>>> stub regmap_read() function that does not modify its output,
>>> however regmap_read() can also fail for other reasons, so
>>> adding error handling (in this case, returning zero from
>>> is_running) seems the best solution.
>>>
>>> Note that this warning showed up with the ARM s5pv210_defconfig,
>>> indicating that we most likely want to either enable CONFIG_REGMAP
>>> in that defconfig as well, or disable the phy-exynos-mipi-video
>>> driver.
>>>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
>>> ---
>>>  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
>>> index cc093ebfda94..8b851f718123 100644
>>> --- a/drivers/phy/phy-exynos-mipi-video.c
>>> +++ b/drivers/phy/phy-exynos-mipi-video.c
>>> @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
>>>                       struct exynos_mipi_video_phy *state)
>>>  {
>>>       u32 val;
>>
>> Other way would be to initialize val=0 since there is no real error code
>> returned. Anyway:
>>
>> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> 
> This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2?

Not in -rc1. Mostly it'll go in -rc2. Generally I start queuing patches after
-rc1 is tagged.

Thanks
Kishon

  reply	other threads:[~2016-05-26  5:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 12:49 [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use Arnd Bergmann
2016-05-11 12:49 ` Arnd Bergmann
2016-05-11 18:51 ` Krzysztof Kozlowski
2016-05-11 18:51   ` Krzysztof Kozlowski
2016-05-25 18:54   ` Arnd Bergmann
2016-05-25 18:54     ` Arnd Bergmann
2016-05-26  5:59     ` Kishon Vijay Abraham I [this message]
2016-05-26  5:59       ` Kishon Vijay Abraham I
2016-05-26  5:59       ` Kishon Vijay Abraham I

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=574690B2.9010204@ti.com \
    --to=kishon@ti.com \
    --cc=arnd@arndb.de \
    --cc=k.kozlowski.k@gmail.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=s.nawrocki@samsung.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 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.