mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/hwtracing/coresight/coresight-tpdm.c:288 dsb_mode_store() warn: unsigned 'val' is never less than zero.
@ 2024-10-14 23:52 kernel test robot
  2024-11-21  2:40 ` [PATCH] coresight: Fix dsb_mode_store() unsigned val " Pei Xiao
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2024-10-14 23:52 UTC (permalink / raw)
  To: Tao Zhang; +Cc: oe-kbuild-all, linux-kernel, Suzuki K Poulose

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   eca631b8fe808748d7585059c4307005ca5c5820
commit: 018e43ad1eeefbb8797e4c933953c50c09e3f4f6 coresight-tpdm: Add node to set dsb programming mode
date:   11 months ago
config: arm-randconfig-r073-20241015 (https://download.01.org/0day-ci/archive/20241015/202410150702.UaZ7kvet-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.1.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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410150702.UaZ7kvet-lkp@intel.com/

smatch warnings:
drivers/hwtracing/coresight/coresight-tpdm.c:288 dsb_mode_store() warn: unsigned 'val' is never less than zero.

vim +/val +288 drivers/hwtracing/coresight/coresight-tpdm.c

   279	
   280	static ssize_t dsb_mode_store(struct device *dev,
   281				      struct device_attribute *attr,
   282				      const char *buf,
   283				      size_t size)
   284	{
   285		struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
   286		unsigned long val;
   287	
 > 288		if ((kstrtoul(buf, 0, &val)) || (val < 0) ||
   289				(val & ~TPDM_DSB_MODE_MASK))
   290			return -EINVAL;
   291	
   292		spin_lock(&drvdata->spinlock);
   293		drvdata->dsb->mode = val & TPDM_DSB_MODE_MASK;
   294		spin_unlock(&drvdata->spinlock);
   295		return size;
   296	}
   297	static DEVICE_ATTR_RW(dsb_mode);
   298	

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

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

* [PATCH] coresight: Fix dsb_mode_store() unsigned val is never less than zero
  2024-10-14 23:52 drivers/hwtracing/coresight/coresight-tpdm.c:288 dsb_mode_store() warn: unsigned 'val' is never less than zero kernel test robot
@ 2024-11-21  2:40 ` Pei Xiao
  2024-11-21 15:17   ` James Clark
  2024-12-11 10:22   ` Suzuki K Poulose
  0 siblings, 2 replies; 5+ messages in thread
From: Pei Xiao @ 2024-11-21  2:40 UTC (permalink / raw)
  To: suzuki.poulose, mike.leach, james.clark, alexander.shishkin,
	coresight, linux-arm-kernel, linux-kernel
  Cc: Pei Xiao, kernel test robot

dsb_mode_store() warn: unsigned 'val' is never less than zero.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410150702.UaZ7kvet-lkp@intel.com/
Fixes: 018e43ad1eee ("coresight-tpdm: Add node to set dsb programming mode")
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 drivers/hwtracing/coresight/coresight-tpdm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
index b7d99e91ab84..158950243d83 100644
--- a/drivers/hwtracing/coresight/coresight-tpdm.c
+++ b/drivers/hwtracing/coresight/coresight-tpdm.c
@@ -640,8 +640,7 @@ static ssize_t dsb_mode_store(struct device *dev,
 	struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
 	unsigned long val;
 
-	if ((kstrtoul(buf, 0, &val)) || (val < 0) ||
-			(val & ~TPDM_DSB_MODE_MASK))
+	if ((kstrtoul(buf, 0, &val)) || (val & ~TPDM_DSB_MODE_MASK))
 		return -EINVAL;
 
 	spin_lock(&drvdata->spinlock);
-- 
2.34.1


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

* Re: [PATCH] coresight: Fix dsb_mode_store() unsigned val is never less than zero
  2024-11-21  2:40 ` [PATCH] coresight: Fix dsb_mode_store() unsigned val " Pei Xiao
@ 2024-11-21 15:17   ` James Clark
  2024-12-11 10:22   ` Suzuki K Poulose
  1 sibling, 0 replies; 5+ messages in thread
From: James Clark @ 2024-11-21 15:17 UTC (permalink / raw)
  To: Pei Xiao, suzuki.poulose
  Cc: kernel test robot, mike.leach, alexander.shishkin, coresight,
	linux-arm-kernel, linux-kernel



On 21/11/2024 2:40 am, Pei Xiao wrote:
> dsb_mode_store() warn: unsigned 'val' is never less than zero.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202410150702.UaZ7kvet-lkp@intel.com/
> Fixes: 018e43ad1eee ("coresight-tpdm: Add node to set dsb programming mode")
> Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
> ---
>   drivers/hwtracing/coresight/coresight-tpdm.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
> index b7d99e91ab84..158950243d83 100644
> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
> @@ -640,8 +640,7 @@ static ssize_t dsb_mode_store(struct device *dev,
>   	struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
>   	unsigned long val;
>   
> -	if ((kstrtoul(buf, 0, &val)) || (val < 0) ||
> -			(val & ~TPDM_DSB_MODE_MASK))
> +	if ((kstrtoul(buf, 0, &val)) || (val & ~TPDM_DSB_MODE_MASK))
>   		return -EINVAL;
>   
>   	spin_lock(&drvdata->spinlock);

Reviewed-by: James Clark <james.clark@linaro.org>


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

* Re: [PATCH] coresight: Fix dsb_mode_store() unsigned val is never less than zero
  2024-11-21  2:40 ` [PATCH] coresight: Fix dsb_mode_store() unsigned val " Pei Xiao
  2024-11-21 15:17   ` James Clark
@ 2024-12-11 10:22   ` Suzuki K Poulose
  1 sibling, 0 replies; 5+ messages in thread
From: Suzuki K Poulose @ 2024-12-11 10:22 UTC (permalink / raw)
  To: linux-arm-kernel, alexander.shishkin, mike.leach, Pei Xiao,
	james.clark, linux-kernel, coresight
  Cc: Suzuki K Poulose, kernel test robot

On Thu, 21 Nov 2024 10:40:03 +0800, Pei Xiao wrote:
> dsb_mode_store() warn: unsigned 'val' is never less than zero.
> 
> 

Applied, thanks!

[1/1] coresight: Fix dsb_mode_store() unsigned val is never less than zero
      https://git.kernel.org/coresight/c/d4276259f3a57131291d879b53fc05863c6b59fa

Best regards,
-- 
Suzuki K Poulose <suzuki.poulose@arm.com>

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

* drivers/hwtracing/coresight/coresight-tpdm.c:288 dsb_mode_store() warn: unsigned 'val' is never less than zero.
@ 2024-12-09  4:53 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2024-12-09  4:53 UTC (permalink / raw)
  To: Tao Zhang; +Cc: oe-kbuild-all, linux-kernel, Suzuki K Poulose

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7503345ac5f5e82fd9a36d6e6b447c016376403a
commit: 018e43ad1eeefbb8797e4c933953c50c09e3f4f6 coresight-tpdm: Add node to set dsb programming mode
date:   1 year, 1 month ago
config: arm64-randconfig-r073-20241207 (https://download.01.org/0day-ci/archive/20241209/202412090231.UXsQuWrr-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 14.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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412090231.UXsQuWrr-lkp@intel.com/

smatch warnings:
drivers/hwtracing/coresight/coresight-tpdm.c:288 dsb_mode_store() warn: unsigned 'val' is never less than zero.

vim +/val +288 drivers/hwtracing/coresight/coresight-tpdm.c

   279	
   280	static ssize_t dsb_mode_store(struct device *dev,
   281				      struct device_attribute *attr,
   282				      const char *buf,
   283				      size_t size)
   284	{
   285		struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
   286		unsigned long val;
   287	
 > 288		if ((kstrtoul(buf, 0, &val)) || (val < 0) ||
   289				(val & ~TPDM_DSB_MODE_MASK))
   290			return -EINVAL;
   291	
   292		spin_lock(&drvdata->spinlock);
   293		drvdata->dsb->mode = val & TPDM_DSB_MODE_MASK;
   294		spin_unlock(&drvdata->spinlock);
   295		return size;
   296	}
   297	static DEVICE_ATTR_RW(dsb_mode);
   298	

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

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

end of thread, other threads:[~2024-12-11 10:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-14 23:52 drivers/hwtracing/coresight/coresight-tpdm.c:288 dsb_mode_store() warn: unsigned 'val' is never less than zero kernel test robot
2024-11-21  2:40 ` [PATCH] coresight: Fix dsb_mode_store() unsigned val " Pei Xiao
2024-11-21 15:17   ` James Clark
2024-12-11 10:22   ` Suzuki K Poulose
2024-12-09  4:53 drivers/hwtracing/coresight/coresight-tpdm.c:288 dsb_mode_store() warn: unsigned 'val' " kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®