oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 1128/2532] drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528)
@ 2024-04-02 14:13 Dan Carpenter
  2024-04-02 15:11 ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2024-04-02 14:13 UTC (permalink / raw
  To: oe-kbuild, Uwe Kleine-König; +Cc: lkp, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   a6bd6c9333397f5a0e2667d4d82fef8c970108f2
commit: d60bc2995732489766cbe650fc367e036ff6a0e0 [1128/2532] pwm: Add a struct device to struct pwm_chip
config: m68k-randconfig-r071-20240326 (https://download.01.org/0day-ci/archive/20240331/202403312030.QYCgiAey-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202403312030.QYCgiAey-lkp@intel.com/

smatch warnings:
drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528)

vim +/pwm +1530 drivers/pwm/core.c

8138d2ddbcca2a Thierry Reding   2012-03-26  1526  void pwm_put(struct pwm_device *pwm)
8138d2ddbcca2a Thierry Reding   2012-03-26  1527  {
d60bc299573248 Uwe Kleine-König 2024-03-17 @1528  	struct pwm_chip *chip = pwm->chip;
                                                                                ^^^^^^^^^^
Dereference

d60bc299573248 Uwe Kleine-König 2024-03-17  1529  
8138d2ddbcca2a Thierry Reding   2012-03-26 @1530  	if (!pwm)
                                                            ^^^^
Too late.

8138d2ddbcca2a Thierry Reding   2012-03-26  1531  		return;
8138d2ddbcca2a Thierry Reding   2012-03-26  1532  
8138d2ddbcca2a Thierry Reding   2012-03-26  1533  	mutex_lock(&pwm_lock);

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 1128/2532] drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528)
  2024-04-02 14:13 [linux-next:master 1128/2532] drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528) Dan Carpenter
@ 2024-04-02 15:11 ` Uwe Kleine-König
  2024-04-30 11:08   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2024-04-02 15:11 UTC (permalink / raw
  To: Dan Carpenter; +Cc: oe-kbuild, lkp, oe-kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

Hello,

On Tue, Apr 02, 2024 at 05:13:15PM +0300, Dan Carpenter wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   a6bd6c9333397f5a0e2667d4d82fef8c970108f2
> commit: d60bc2995732489766cbe650fc367e036ff6a0e0 [1128/2532] pwm: Add a struct device to struct pwm_chip
> config: m68k-randconfig-r071-20240326 (https://download.01.org/0day-ci/archive/20240331/202403312030.QYCgiAey-lkp@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 13.2.0
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202403312030.QYCgiAey-lkp@intel.com/
> 
> smatch warnings:
> drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528)
> 
> vim +/pwm +1530 drivers/pwm/core.c
> 
> 8138d2ddbcca2a Thierry Reding   2012-03-26  1526  void pwm_put(struct pwm_device *pwm)
> 8138d2ddbcca2a Thierry Reding   2012-03-26  1527  {
> d60bc299573248 Uwe Kleine-König 2024-03-17 @1528  	struct pwm_chip *chip = pwm->chip;
>                                                                                 ^^^^^^^^^^
> Dereference
> 
> d60bc299573248 Uwe Kleine-König 2024-03-17  1529  
> 8138d2ddbcca2a Thierry Reding   2012-03-26 @1530  	if (!pwm)
>                                                             ^^^^
> Too late.
> 
> 8138d2ddbcca2a Thierry Reding   2012-03-26  1531  		return;
> 8138d2ddbcca2a Thierry Reding   2012-03-26  1532  
> 8138d2ddbcca2a Thierry Reding   2012-03-26  1533  	mutex_lock(&pwm_lock);

This is already addressed in fbf632f9dc55.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 1128/2532] drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528)
  2024-04-02 15:11 ` Uwe Kleine-König
@ 2024-04-30 11:08   ` Dan Carpenter
  2024-04-30 16:59     ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2024-04-30 11:08 UTC (permalink / raw
  To: Uwe Kleine-König; +Cc: oe-kbuild, lkp, oe-kbuild-all

On Tue, Apr 02, 2024 at 05:11:22PM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> > 8138d2ddbcca2a Thierry Reding   2012-03-26  1526  void pwm_put(struct pwm_device *pwm)
> > 8138d2ddbcca2a Thierry Reding   2012-03-26  1527  {
> > d60bc299573248 Uwe Kleine-König 2024-03-17 @1528  	struct pwm_chip *chip = pwm->chip;
> >                                                                                 ^^^^^^^^^^
> > Dereference
> > 
> > d60bc299573248 Uwe Kleine-König 2024-03-17  1529  
> > 8138d2ddbcca2a Thierry Reding   2012-03-26 @1530  	if (!pwm)
> >                                                             ^^^^
> > Too late.
> > 
> > 8138d2ddbcca2a Thierry Reding   2012-03-26  1531  		return;
> > 8138d2ddbcca2a Thierry Reding   2012-03-26  1532  
> > 8138d2ddbcca2a Thierry Reding   2012-03-26  1533  	mutex_lock(&pwm_lock);
> 
> This is already addressed in fbf632f9dc55.
> 

Apparently we never merged that commit, though...  It's not in
linux-next.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 1128/2532] drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528)
  2024-04-30 11:08   ` Dan Carpenter
@ 2024-04-30 16:59     ` Uwe Kleine-König
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2024-04-30 16:59 UTC (permalink / raw
  To: Dan Carpenter; +Cc: oe-kbuild, lkp, oe-kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]

Hello Dan,

On Tue, Apr 30, 2024 at 02:08:05PM +0300, Dan Carpenter wrote:
> On Tue, Apr 02, 2024 at 05:11:22PM +0200, Uwe Kleine-König wrote:
> > Hello,
> > 
> > > 8138d2ddbcca2a Thierry Reding   2012-03-26  1526  void pwm_put(struct pwm_device *pwm)
> > > 8138d2ddbcca2a Thierry Reding   2012-03-26  1527  {
> > > d60bc299573248 Uwe Kleine-König 2024-03-17 @1528  	struct pwm_chip *chip = pwm->chip;
> > >                                                                                 ^^^^^^^^^^
> > > Dereference
> > > 
> > > d60bc299573248 Uwe Kleine-König 2024-03-17  1529  
> > > 8138d2ddbcca2a Thierry Reding   2012-03-26 @1530  	if (!pwm)
> > >                                                             ^^^^
> > > Too late.
> > > 
> > > 8138d2ddbcca2a Thierry Reding   2012-03-26  1531  		return;
> > > 8138d2ddbcca2a Thierry Reding   2012-03-26  1532  
> > > 8138d2ddbcca2a Thierry Reding   2012-03-26  1533  	mutex_lock(&pwm_lock);
> > 
> > This is already addressed in fbf632f9dc55.
> > 
> 
> Apparently we never merged that commit, though...  It's not in
> linux-next.

Oh, I recently dropped a few commits from my for-next branch and this
one was (wrongly) among them. Thanks for paying attention, it's back
now.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-30 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 14:13 [linux-next:master 1128/2532] drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528) Dan Carpenter
2024-04-02 15:11 ` Uwe Kleine-König
2024-04-30 11:08   ` Dan Carpenter
2024-04-30 16:59     ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).