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]
Date:   Tue, 7 Feb 2017 03:02:05 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Herbert Xu <herbert@...dor.apana.org.au>
Cc:     kbuild-all@...org, Stephen Rothwell <sfr@...b.auug.org.au>,
        linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
        Cyrille Pitchen <cyrille.pitchen@...el.com>,
        Linux Crypto Mailing List <linux-crypto@...r.kernel.org>
Subject: Re: crypto: atmel - Fix authenc compile test warnings

Hi Herbert,

[auto build test WARNING on cryptodev/master]
[also build test WARNING on v4.10-rc7]
[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/Herbert-Xu/crypto-atmel-Fix-authenc-compile-test-warnings/20170206-171201
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=tile 

All warnings (new ones prefixed by >>):

   drivers/crypto/atmel-tdes.c: In function 'atmel_tdes_sg_copy':
>> drivers/crypto/atmel-tdes.c:157:11: warning: comparison of distinct pointer types lacks a cast [enabled by default]
   drivers/crypto/atmel-tdes.c: In function 'atmel_tdes_crypt_pdc_stop':
>> drivers/crypto/atmel-tdes.c:339:4: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'size_t' [-Wformat]
   drivers/crypto/atmel-tdes.c: In function 'atmel_tdes_buff_init':
>> drivers/crypto/atmel-tdes.c:364:3: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat]
   drivers/crypto/atmel-tdes.c:372:3: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat]
   drivers/crypto/atmel-tdes.c: In function 'atmel_tdes_crypt_start':
   drivers/crypto/atmel-tdes.c:528:11: warning: comparison of distinct pointer types lacks a cast [enabled by default]
   drivers/crypto/atmel-tdes.c:529:11: warning: comparison of distinct pointer types lacks a cast [enabled by default]
   drivers/crypto/atmel-tdes.c: In function 'atmel_tdes_crypt_dma_stop':
   drivers/crypto/atmel-tdes.c:664:5: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'size_t' [-Wformat]

vim +157 drivers/crypto/atmel-tdes.c

13802005 Nicolas Royer  2012-07-01  151  			void *buf, size_t buflen, size_t total, int out)
13802005 Nicolas Royer  2012-07-01  152  {
13802005 Nicolas Royer  2012-07-01  153  	unsigned int count, off = 0;
13802005 Nicolas Royer  2012-07-01  154  
13802005 Nicolas Royer  2012-07-01  155  	while (buflen && total) {
13802005 Nicolas Royer  2012-07-01  156  		count = min((*sg)->length - *offset, total);
13802005 Nicolas Royer  2012-07-01 @157  		count = min(count, buflen);
13802005 Nicolas Royer  2012-07-01  158  
13802005 Nicolas Royer  2012-07-01  159  		if (!count)
13802005 Nicolas Royer  2012-07-01  160  			return off;
13802005 Nicolas Royer  2012-07-01  161  
13802005 Nicolas Royer  2012-07-01  162  		scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out);
13802005 Nicolas Royer  2012-07-01  163  
13802005 Nicolas Royer  2012-07-01  164  		off += count;
13802005 Nicolas Royer  2012-07-01  165  		buflen -= count;
13802005 Nicolas Royer  2012-07-01  166  		*offset += count;
13802005 Nicolas Royer  2012-07-01  167  		total -= count;
13802005 Nicolas Royer  2012-07-01  168  
13802005 Nicolas Royer  2012-07-01  169  		if (*offset == (*sg)->length) {
13802005 Nicolas Royer  2012-07-01  170  			*sg = sg_next(*sg);
13802005 Nicolas Royer  2012-07-01  171  			if (*sg)
13802005 Nicolas Royer  2012-07-01  172  				*offset = 0;
13802005 Nicolas Royer  2012-07-01  173  			else
13802005 Nicolas Royer  2012-07-01  174  				total = 0;
13802005 Nicolas Royer  2012-07-01  175  		}
13802005 Nicolas Royer  2012-07-01  176  	}
13802005 Nicolas Royer  2012-07-01  177  
13802005 Nicolas Royer  2012-07-01  178  	return off;
13802005 Nicolas Royer  2012-07-01  179  }
13802005 Nicolas Royer  2012-07-01  180  
13802005 Nicolas Royer  2012-07-01  181  static inline u32 atmel_tdes_read(struct atmel_tdes_dev *dd, u32 offset)
13802005 Nicolas Royer  2012-07-01  182  {
13802005 Nicolas Royer  2012-07-01  183  	return readl_relaxed(dd->io_base + offset);
13802005 Nicolas Royer  2012-07-01  184  }
13802005 Nicolas Royer  2012-07-01  185  
13802005 Nicolas Royer  2012-07-01  186  static inline void atmel_tdes_write(struct atmel_tdes_dev *dd,
13802005 Nicolas Royer  2012-07-01  187  					u32 offset, u32 value)
13802005 Nicolas Royer  2012-07-01  188  {
13802005 Nicolas Royer  2012-07-01  189  	writel_relaxed(value, dd->io_base + offset);
13802005 Nicolas Royer  2012-07-01  190  }
13802005 Nicolas Royer  2012-07-01  191  
13802005 Nicolas Royer  2012-07-01  192  static void atmel_tdes_write_n(struct atmel_tdes_dev *dd, u32 offset,
13802005 Nicolas Royer  2012-07-01  193  					u32 *value, int count)
13802005 Nicolas Royer  2012-07-01  194  {
13802005 Nicolas Royer  2012-07-01  195  	for (; count--; value++, offset += 4)
13802005 Nicolas Royer  2012-07-01  196  		atmel_tdes_write(dd, offset, *value);
13802005 Nicolas Royer  2012-07-01  197  }
13802005 Nicolas Royer  2012-07-01  198  
13802005 Nicolas Royer  2012-07-01  199  static struct atmel_tdes_dev *atmel_tdes_find_dev(struct atmel_tdes_ctx *ctx)
13802005 Nicolas Royer  2012-07-01  200  {
13802005 Nicolas Royer  2012-07-01  201  	struct atmel_tdes_dev *tdes_dd = NULL;
13802005 Nicolas Royer  2012-07-01  202  	struct atmel_tdes_dev *tmp;
13802005 Nicolas Royer  2012-07-01  203  
13802005 Nicolas Royer  2012-07-01  204  	spin_lock_bh(&atmel_tdes.lock);
13802005 Nicolas Royer  2012-07-01  205  	if (!ctx->dd) {
13802005 Nicolas Royer  2012-07-01  206  		list_for_each_entry(tmp, &atmel_tdes.dev_list, list) {
13802005 Nicolas Royer  2012-07-01  207  			tdes_dd = tmp;
13802005 Nicolas Royer  2012-07-01  208  			break;
13802005 Nicolas Royer  2012-07-01  209  		}
13802005 Nicolas Royer  2012-07-01  210  		ctx->dd = tdes_dd;
13802005 Nicolas Royer  2012-07-01  211  	} else {
13802005 Nicolas Royer  2012-07-01  212  		tdes_dd = ctx->dd;
13802005 Nicolas Royer  2012-07-01  213  	}
13802005 Nicolas Royer  2012-07-01  214  	spin_unlock_bh(&atmel_tdes.lock);
13802005 Nicolas Royer  2012-07-01  215  
13802005 Nicolas Royer  2012-07-01  216  	return tdes_dd;
13802005 Nicolas Royer  2012-07-01  217  }
13802005 Nicolas Royer  2012-07-01  218  
13802005 Nicolas Royer  2012-07-01  219  static int atmel_tdes_hw_init(struct atmel_tdes_dev *dd)
13802005 Nicolas Royer  2012-07-01  220  {
9d83d299 LABBE Corentin 2015-10-02  221  	int err;
9d83d299 LABBE Corentin 2015-10-02  222  
9d83d299 LABBE Corentin 2015-10-02  223  	err = clk_prepare_enable(dd->iclk);
9d83d299 LABBE Corentin 2015-10-02  224  	if (err)
9d83d299 LABBE Corentin 2015-10-02  225  		return err;
13802005 Nicolas Royer  2012-07-01  226  
13802005 Nicolas Royer  2012-07-01  227  	if (!(dd->flags & TDES_FLAGS_INIT)) {
13802005 Nicolas Royer  2012-07-01  228  		atmel_tdes_write(dd, TDES_CR, TDES_CR_SWRST);
13802005 Nicolas Royer  2012-07-01  229  		dd->flags |= TDES_FLAGS_INIT;
13802005 Nicolas Royer  2012-07-01  230  		dd->err = 0;
13802005 Nicolas Royer  2012-07-01  231  	}
13802005 Nicolas Royer  2012-07-01  232  
13802005 Nicolas Royer  2012-07-01  233  	return 0;
13802005 Nicolas Royer  2012-07-01  234  }
13802005 Nicolas Royer  2012-07-01  235  
1f858040 Nicolas Royer  2013-02-20  236  static inline unsigned int atmel_tdes_get_version(struct atmel_tdes_dev *dd)
1f858040 Nicolas Royer  2013-02-20  237  {
1f858040 Nicolas Royer  2013-02-20  238  	return atmel_tdes_read(dd, TDES_HW_VERSION) & 0x00000fff;
1f858040 Nicolas Royer  2013-02-20  239  }
1f858040 Nicolas Royer  2013-02-20  240  
1f858040 Nicolas Royer  2013-02-20  241  static void atmel_tdes_hw_version_init(struct atmel_tdes_dev *dd)
1f858040 Nicolas Royer  2013-02-20  242  {
1f858040 Nicolas Royer  2013-02-20  243  	atmel_tdes_hw_init(dd);
1f858040 Nicolas Royer  2013-02-20  244  
1f858040 Nicolas Royer  2013-02-20  245  	dd->hw_version = atmel_tdes_get_version(dd);
1f858040 Nicolas Royer  2013-02-20  246  
1f858040 Nicolas Royer  2013-02-20  247  	dev_info(dd->dev,
1f858040 Nicolas Royer  2013-02-20  248  			"version: 0x%x\n", dd->hw_version);
1f858040 Nicolas Royer  2013-02-20  249  
1f858040 Nicolas Royer  2013-02-20  250  	clk_disable_unprepare(dd->iclk);
1f858040 Nicolas Royer  2013-02-20  251  }
1f858040 Nicolas Royer  2013-02-20  252  
1f858040 Nicolas Royer  2013-02-20  253  static void atmel_tdes_dma_callback(void *data)
1f858040 Nicolas Royer  2013-02-20  254  {
1f858040 Nicolas Royer  2013-02-20  255  	struct atmel_tdes_dev *dd = data;
1f858040 Nicolas Royer  2013-02-20  256  
1f858040 Nicolas Royer  2013-02-20  257  	/* dma_lch_out - completed */
1f858040 Nicolas Royer  2013-02-20  258  	tasklet_schedule(&dd->done_task);
1f858040 Nicolas Royer  2013-02-20  259  }
1f858040 Nicolas Royer  2013-02-20  260  
13802005 Nicolas Royer  2012-07-01  261  static int atmel_tdes_write_ctrl(struct atmel_tdes_dev *dd)
13802005 Nicolas Royer  2012-07-01  262  {
13802005 Nicolas Royer  2012-07-01  263  	int err;
13802005 Nicolas Royer  2012-07-01  264  	u32 valcr = 0, valmr = TDES_MR_SMOD_PDC;
13802005 Nicolas Royer  2012-07-01  265  
13802005 Nicolas Royer  2012-07-01  266  	err = atmel_tdes_hw_init(dd);
13802005 Nicolas Royer  2012-07-01  267  
13802005 Nicolas Royer  2012-07-01  268  	if (err)
13802005 Nicolas Royer  2012-07-01  269  		return err;
13802005 Nicolas Royer  2012-07-01  270  
1f858040 Nicolas Royer  2013-02-20  271  	if (!dd->caps.has_dma)
1f858040 Nicolas Royer  2013-02-20  272  		atmel_tdes_write(dd, TDES_PTCR,
1f858040 Nicolas Royer  2013-02-20  273  			TDES_PTCR_TXTDIS | TDES_PTCR_RXTDIS);
13802005 Nicolas Royer  2012-07-01  274  
13802005 Nicolas Royer  2012-07-01  275  	/* MR register must be set before IV registers */
13802005 Nicolas Royer  2012-07-01  276  	if (dd->ctx->keylen > (DES_KEY_SIZE << 1)) {
13802005 Nicolas Royer  2012-07-01  277  		valmr |= TDES_MR_KEYMOD_3KEY;
13802005 Nicolas Royer  2012-07-01  278  		valmr |= TDES_MR_TDESMOD_TDES;
13802005 Nicolas Royer  2012-07-01  279  	} else if (dd->ctx->keylen > DES_KEY_SIZE) {
13802005 Nicolas Royer  2012-07-01  280  		valmr |= TDES_MR_KEYMOD_2KEY;
13802005 Nicolas Royer  2012-07-01  281  		valmr |= TDES_MR_TDESMOD_TDES;
13802005 Nicolas Royer  2012-07-01  282  	} else {
13802005 Nicolas Royer  2012-07-01  283  		valmr |= TDES_MR_TDESMOD_DES;
13802005 Nicolas Royer  2012-07-01  284  	}
13802005 Nicolas Royer  2012-07-01  285  
13802005 Nicolas Royer  2012-07-01  286  	if (dd->flags & TDES_FLAGS_CBC) {
13802005 Nicolas Royer  2012-07-01  287  		valmr |= TDES_MR_OPMOD_CBC;
13802005 Nicolas Royer  2012-07-01  288  	} else if (dd->flags & TDES_FLAGS_CFB) {
13802005 Nicolas Royer  2012-07-01  289  		valmr |= TDES_MR_OPMOD_CFB;
13802005 Nicolas Royer  2012-07-01  290  
13802005 Nicolas Royer  2012-07-01  291  		if (dd->flags & TDES_FLAGS_CFB8)
13802005 Nicolas Royer  2012-07-01  292  			valmr |= TDES_MR_CFBS_8b;
13802005 Nicolas Royer  2012-07-01  293  		else if (dd->flags & TDES_FLAGS_CFB16)
13802005 Nicolas Royer  2012-07-01  294  			valmr |= TDES_MR_CFBS_16b;
13802005 Nicolas Royer  2012-07-01  295  		else if (dd->flags & TDES_FLAGS_CFB32)
13802005 Nicolas Royer  2012-07-01  296  			valmr |= TDES_MR_CFBS_32b;
1f858040 Nicolas Royer  2013-02-20  297  		else if (dd->flags & TDES_FLAGS_CFB64)
1f858040 Nicolas Royer  2013-02-20  298  			valmr |= TDES_MR_CFBS_64b;
13802005 Nicolas Royer  2012-07-01  299  	} else if (dd->flags & TDES_FLAGS_OFB) {
13802005 Nicolas Royer  2012-07-01  300  		valmr |= TDES_MR_OPMOD_OFB;
13802005 Nicolas Royer  2012-07-01  301  	}
13802005 Nicolas Royer  2012-07-01  302  
13802005 Nicolas Royer  2012-07-01  303  	if ((dd->flags & TDES_FLAGS_ENCRYPT) || (dd->flags & TDES_FLAGS_OFB))
13802005 Nicolas Royer  2012-07-01  304  		valmr |= TDES_MR_CYPHER_ENC;
13802005 Nicolas Royer  2012-07-01  305  
13802005 Nicolas Royer  2012-07-01  306  	atmel_tdes_write(dd, TDES_CR, valcr);
13802005 Nicolas Royer  2012-07-01  307  	atmel_tdes_write(dd, TDES_MR, valmr);
13802005 Nicolas Royer  2012-07-01  308  
13802005 Nicolas Royer  2012-07-01  309  	atmel_tdes_write_n(dd, TDES_KEY1W1R, dd->ctx->key,
13802005 Nicolas Royer  2012-07-01  310  						dd->ctx->keylen >> 2);
13802005 Nicolas Royer  2012-07-01  311  
13802005 Nicolas Royer  2012-07-01  312  	if (((dd->flags & TDES_FLAGS_CBC) || (dd->flags & TDES_FLAGS_CFB) ||
13802005 Nicolas Royer  2012-07-01  313  		(dd->flags & TDES_FLAGS_OFB)) && dd->req->info) {
13802005 Nicolas Royer  2012-07-01  314  		atmel_tdes_write_n(dd, TDES_IV1R, dd->req->info, 2);
13802005 Nicolas Royer  2012-07-01  315  	}
13802005 Nicolas Royer  2012-07-01  316  
13802005 Nicolas Royer  2012-07-01  317  	return 0;
13802005 Nicolas Royer  2012-07-01  318  }
13802005 Nicolas Royer  2012-07-01  319  
1f858040 Nicolas Royer  2013-02-20  320  static int atmel_tdes_crypt_pdc_stop(struct atmel_tdes_dev *dd)
13802005 Nicolas Royer  2012-07-01  321  {
13802005 Nicolas Royer  2012-07-01  322  	int err = 0;
13802005 Nicolas Royer  2012-07-01  323  	size_t count;
13802005 Nicolas Royer  2012-07-01  324  
13802005 Nicolas Royer  2012-07-01  325  	atmel_tdes_write(dd, TDES_PTCR, TDES_PTCR_TXTDIS|TDES_PTCR_RXTDIS);
13802005 Nicolas Royer  2012-07-01  326  
13802005 Nicolas Royer  2012-07-01  327  	if (dd->flags & TDES_FLAGS_FAST) {
13802005 Nicolas Royer  2012-07-01  328  		dma_unmap_sg(dd->dev, dd->out_sg, 1, DMA_FROM_DEVICE);
13802005 Nicolas Royer  2012-07-01  329  		dma_unmap_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE);
13802005 Nicolas Royer  2012-07-01  330  	} else {
13802005 Nicolas Royer  2012-07-01  331  		dma_sync_single_for_device(dd->dev, dd->dma_addr_out,
13802005 Nicolas Royer  2012-07-01  332  					   dd->dma_size, DMA_FROM_DEVICE);
13802005 Nicolas Royer  2012-07-01  333  
13802005 Nicolas Royer  2012-07-01  334  		/* copy data */
13802005 Nicolas Royer  2012-07-01  335  		count = atmel_tdes_sg_copy(&dd->out_sg, &dd->out_offset,
13802005 Nicolas Royer  2012-07-01  336  				dd->buf_out, dd->buflen, dd->dma_size, 1);
13802005 Nicolas Royer  2012-07-01  337  		if (count != dd->dma_size) {
13802005 Nicolas Royer  2012-07-01  338  			err = -EINVAL;
13802005 Nicolas Royer  2012-07-01 @339  			pr_err("not all data converted: %u\n", count);
13802005 Nicolas Royer  2012-07-01  340  		}
13802005 Nicolas Royer  2012-07-01  341  	}
13802005 Nicolas Royer  2012-07-01  342  

:::::: The code at line 157 was first introduced by commit
:::::: 13802005d8f2db244ec1f5d7f6923de8f7a463db crypto: atmel - add Atmel DES/TDES driver

:::::: TO: Nicolas Royer <nicolas@...rea.com>
:::::: CC: Herbert Xu <herbert@...dor.apana.org.au>

---
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" (47135 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ