[PATCH v2] mtd: Verify written data in paranoid mode

kernel test robot lkp at intel.com
Thu May 8 22:28:38 PDT 2025


Hi Bence,

kernel test robot noticed the following build warnings:

[auto build test WARNING on d76bb1ebb5587f66b0f8b8099bfbb44722bc08b3]

url:    https://github.com/intel-lab-lkp/linux/commits/Bence-Cs-k-s/mtd-Verify-written-data-in-paranoid-mode/20250509-024044
base:   d76bb1ebb5587f66b0f8b8099bfbb44722bc08b3
patch link:    https://lore.kernel.org/r/20250508183733.514124-3-csokas.bence%40prolan.hu
patch subject: [PATCH v2] mtd: Verify written data in paranoid mode
config: i386-buildonly-randconfig-002-20250509 (https://download.01.org/0day-ci/archive/20250509/202505091318.0QvCicb9-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505091318.0QvCicb9-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505091318.0QvCicb9-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mtd/mtdcore.c:1775:12: warning: '_mtd_verify' defined but not used [-Wunused-function]
    1775 | static int _mtd_verify(struct mtd_info *mtd, loff_t to, size_t len, const u8 *buf)
         |            ^~~~~~~~~~~


vim +/_mtd_verify +1775 drivers/mtd/mtdcore.c

  1774	
> 1775	static int _mtd_verify(struct mtd_info *mtd, loff_t to, size_t len, const u8 *buf)
  1776	{
  1777		struct device *dev = &mtd->dev;
  1778		u_char *verify_buf;
  1779		size_t r_retlen;
  1780		int ret;
  1781	
  1782		verify_buf = devm_kmalloc(dev, len, GFP_KERNEL);
  1783		if (!verify_buf)
  1784			return -ENOMEM;
  1785	
  1786		ret = mtd_read(mtd, to, len, &r_retlen, verify_buf);
  1787		if (ret < 0)
  1788			goto err;
  1789	
  1790		if (len != r_retlen) {
  1791			/* We shouldn't see short reads */
  1792			dev_err(dev, "Verify failed, written %zd but only read %zd",
  1793				len, r_retlen);
  1794			ret = -EIO;
  1795			goto err;
  1796		}
  1797	
  1798		if (memcmp(verify_buf, buf, len)) {
  1799			dev_err(dev, "Verify failed, compare mismatch!");
  1800			ret = -EIO;
  1801		}
  1802	
  1803	err:
  1804		devm_kfree(dev, verify_buf);
  1805		return ret;
  1806	}
  1807	

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



More information about the linux-mtd mailing list