lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201902050701.IVcVooah%fengguang.wu@intel.com>
Date:   Tue, 5 Feb 2019 07:05:11 +0800
From:   kbuild test robot <lkp@...el.com>
To:     "Shivamurthy Shastri (sshivamurthy)" <sshivamurthy@...ron.com>
Cc:     kbuild-all@...org, Boris Brezillon <bbrezillon@...nel.org>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Richard Weinberger <richard@....at>,
        David Woodhouse <dwmw2@...radead.org>,
        Brian Norris <computersforpeace@...il.com>,
        Marek Vasut <marek.vasut@...il.com>,
        Frieder Schrempf <frieder.schrempf@...eet.de>,
        "Bean Huo (beanhuo)" <beanhuo@...ron.com>,
        Schrempf Frieder <frieder.schrempf@...tron.De>,
        Chuanhong Guo <gch981213@...il.com>
Subject: Re: [PATCH 2/2] mtd: spinand: micron: Support for all Micron SPI
 NAND flashes

Hi Shivamurthy,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mtd/nand/next]
[also build test WARNING on v5.0-rc4 next-20190204]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Shivamurthy-Shastri-sshivamurthy/Support-parameter-page-and-Redesign-Micron-SPI-NAND/20190205-012740
base:   git://git.infradead.org/linux-mtd.git nand/next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

All warnings (new ones prefixed by >>):

>> drivers/mtd/nand/spi/micron.c:186:36: sparse: warning: incorrect type in assignment (different base types)
   drivers/mtd/nand/spi/micron.c:186:36: sparse:    expected unsigned int [assigned] pagesize
   drivers/mtd/nand/spi/micron.c:186:36: sparse:    got restricted __le32 [usertype] byte_per_page
   drivers/mtd/nand/spi/micron.c:187:35: sparse: warning: incorrect type in assignment (different base types)
   drivers/mtd/nand/spi/micron.c:187:35: sparse:    expected unsigned int [assigned] oobsize
   drivers/mtd/nand/spi/micron.c:187:35: sparse:    got restricted __le16 [usertype] spare_bytes_per_page
   drivers/mtd/nand/spi/micron.c:188:48: sparse: warning: incorrect type in assignment (different base types)
   drivers/mtd/nand/spi/micron.c:188:48: sparse:    expected unsigned int [assigned] pages_per_eraseblock
   drivers/mtd/nand/spi/micron.c:188:48: sparse:    got restricted __le32 [usertype] pages_per_block
>> drivers/mtd/nand/spi/micron.c:190:23: sparse: warning: restricted __le32 degrades to integer

sparse warnings: (new ones prefixed by >>)

   drivers/mtd/nand/spi/micron.c:186:36: sparse: warning: incorrect type in assignment (different base types)
>> drivers/mtd/nand/spi/micron.c:186:36: sparse:    expected unsigned int [assigned] pagesize
>> drivers/mtd/nand/spi/micron.c:186:36: sparse:    got restricted __le32 [usertype] byte_per_page
   drivers/mtd/nand/spi/micron.c:187:35: sparse: warning: incorrect type in assignment (different base types)
>> drivers/mtd/nand/spi/micron.c:187:35: sparse:    expected unsigned int [assigned] oobsize
>> drivers/mtd/nand/spi/micron.c:187:35: sparse:    got restricted __le16 [usertype] spare_bytes_per_page
   drivers/mtd/nand/spi/micron.c:188:48: sparse: warning: incorrect type in assignment (different base types)
>> drivers/mtd/nand/spi/micron.c:188:48: sparse:    expected unsigned int [assigned] pages_per_eraseblock
>> drivers/mtd/nand/spi/micron.c:188:48: sparse:    got restricted __le32 [usertype] pages_per_block
   drivers/mtd/nand/spi/micron.c:190:23: sparse: warning: restricted __le32 degrades to integer

vim +186 drivers/mtd/nand/spi/micron.c

   127	
   128	static int micron_spinand_detect(struct spinand_device *spinand)
   129	{
   130		struct spinand_info deviceinfo;
   131		struct micron_spinand_params *params;
   132		u8 *id = spinand->id.data;
   133		int ret, i;
   134	
   135		/*
   136		 * Micron SPI NAND read ID need a dummy byte,
   137		 * so the first byte in raw_id is dummy.
   138		 */
   139		if (id[1] != SPINAND_MFR_MICRON)
   140			return 0;
   141	
   142		params = kzalloc(sizeof(*params) * 3, GFP_KERNEL);
   143		if (!params)
   144			return -ENOMEM;
   145	
   146		ret = spinand_parameter_page_read(spinand, PARAMETER_PAGE, params,
   147						  sizeof(*params) * 3);
   148		if (ret)
   149			goto free_params;
   150	
   151		for (i = 0; i < 3; i++) {
   152			if (spinand_crc16(0x4F4E, (u8 *)&params[i], 254) ==
   153					le16_to_cpu(params->crc)) {
   154				if (i)
   155					memcpy(params, &params[i], sizeof(*params));
   156				break;
   157			}
   158		}
   159	
   160		if (i == 3) {
   161			const void *srcbufs[3] = {params, params + 1, params + 2};
   162	
   163			pr_warn("No valid parameter page, trying bit-wise majority to recover it\n");
   164			bit_wise_majority(srcbufs, ARRAY_SIZE(srcbufs), params,
   165					  sizeof(*params));
   166	
   167			if (spinand_crc16(0x4F4E, (u8 *)params, 254) !=
   168					le16_to_cpu(params->crc)) {
   169				pr_err("Parameter page recovery failed, aborting\n");
   170				goto free_params;
   171			}
   172		}
   173	
   174		params->model[sizeof(params->model) - 1] = 0;
   175		strim(params->model);
   176	
   177		deviceinfo.model = kstrdup(params->model, GFP_KERNEL);
   178		if (!deviceinfo.model) {
   179			ret = -ENOMEM;
   180			goto free_params;
   181		}
   182	
   183		deviceinfo.devid = id[2];
   184		deviceinfo.flags = 0;
   185		deviceinfo.memorg.bits_per_cell = params->bits_per_cell;
 > 186		deviceinfo.memorg.pagesize = params->byte_per_page;
 > 187		deviceinfo.memorg.oobsize = params->spare_bytes_per_page;
 > 188		deviceinfo.memorg.pages_per_eraseblock = params->pages_per_block;
   189		deviceinfo.memorg.eraseblocks_per_lun =
 > 190			params->blocks_per_lun * params->lun_count;
   191		deviceinfo.memorg.planes_per_lun = params->lun_count;
   192		deviceinfo.memorg.luns_per_target = 1;
   193		deviceinfo.memorg.ntargets = 1;
   194		deviceinfo.eccreq.strength = params->ecc_max_correct_ability;
   195		deviceinfo.eccreq.step_size = 512;
   196		deviceinfo.eccinfo.get_status = ecc_get_status;
   197		deviceinfo.eccinfo.ooblayout = &ooblayout;
   198		deviceinfo.op_variants.read_cache = &read_cache_variants;
   199		deviceinfo.op_variants.write_cache = &write_cache_variants;
   200		deviceinfo.op_variants.update_cache = &update_cache_variants;
   201	
   202		ret = spinand_match_and_init(spinand, &deviceinfo,
   203					     1, id[2]);
   204		if (ret)
   205			goto free_model;
   206	
   207		kfree(params);
   208	
   209		return 1;
   210	
   211	free_model:
   212		kfree(deviceinfo.model);
   213	free_params:
   214		kfree(params);
   215	
   216		return ret;
   217	}
   218	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (67299 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ