public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Andre Przywara <andre.przywara@arm.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Jernej Škrabec " <jernej.skrabec@gmail.com>
Subject: drivers/cpufreq/sun50i-cpufreq-nvmem.c:229:20: sparse: sparse: cast to restricted __le32
Date: Mon, 02 Mar 2026 17:54:21 +0800	[thread overview]
Message-ID: <202603021703.aBD0w99y-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   11439c4635edd669ae435eec308f4ab8a0804808
commit: 14c8a418159e541d70dbf8fc71225d1623beaf0f cpufreq: sun50i: prevent out-of-bounds access
date:   11 months ago
config: riscv-randconfig-r133-20260302 (https://download.01.org/0day-ci/archive/20260302/202603021703.aBD0w99y-lkp@intel.com/config)
compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260302/202603021703.aBD0w99y-lkp@intel.com/reproduce)

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/202603021703.aBD0w99y-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/cpufreq/sun50i-cpufreq-nvmem.c:229:20: sparse: sparse: cast to restricted __le32

vim +229 drivers/cpufreq/sun50i-cpufreq-nvmem.c

   184	
   185	/**
   186	 * sun50i_cpufreq_get_efuse() - Determine speed grade from efuse value
   187	 *
   188	 * Returns non-negative speed bin index on success, a negative error
   189	 * value otherwise.
   190	 */
   191	static int sun50i_cpufreq_get_efuse(void)
   192	{
   193		const struct sunxi_cpufreq_data *opp_data;
   194		struct nvmem_cell *speedbin_nvmem;
   195		const struct of_device_id *match;
   196		struct device *cpu_dev;
   197		void *speedbin_ptr;
   198		u32 speedbin = 0;
   199		size_t len;
   200		int ret;
   201	
   202		cpu_dev = get_cpu_device(0);
   203		if (!cpu_dev)
   204			return -ENODEV;
   205	
   206		struct device_node *np __free(device_node) =
   207			dev_pm_opp_of_get_opp_desc_node(cpu_dev);
   208		if (!np)
   209			return -ENOENT;
   210	
   211		match = of_match_node(cpu_opp_match_list, np);
   212		if (!match)
   213			return -ENOENT;
   214	
   215		opp_data = match->data;
   216	
   217		speedbin_nvmem = of_nvmem_cell_get(np, NULL);
   218		if (IS_ERR(speedbin_nvmem))
   219			return dev_err_probe(cpu_dev, PTR_ERR(speedbin_nvmem),
   220					     "Could not get nvmem cell\n");
   221	
   222		speedbin_ptr = nvmem_cell_read(speedbin_nvmem, &len);
   223		nvmem_cell_put(speedbin_nvmem);
   224		if (IS_ERR(speedbin_ptr))
   225			return PTR_ERR(speedbin_ptr);
   226	
   227		if (len <= 4)
   228			memcpy(&speedbin, speedbin_ptr, len);
 > 229		speedbin = le32_to_cpu(speedbin);
   230	
   231		ret = opp_data->efuse_xlate(speedbin);
   232	
   233		kfree(speedbin_ptr);
   234	
   235		return ret;
   236	};
   237	

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

                 reply	other threads:[~2026-03-02  9:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202603021703.aBD0w99y-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=andre.przywara@arm.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=viresh.kumar@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox