All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [linux-next:master 8312/12711] drivers/firmware/turris-mox-rwtm.c:386:27: sparse: sparse: incorrect type in argument 1 (different base types)
Date: Thu, 30 Jul 2020 11:31:33 +0800	[thread overview]
Message-ID: <202007301131.de0PExia%lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4173 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   04b4571786305a76ad81757bbec78eb16a5de582
commit: 50524d787de34300ca9189e63afe13e26d782bea [8312/12711] firmware: turris-mox-rwtm: support ECDSA signatures via debugfs
config: arm64-randconfig-s032-20200729 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-97-gee4aea9a-dirty
        git checkout 50524d787de34300ca9189e63afe13e26d782bea
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> drivers/firmware/turris-mox-rwtm.c:386:27: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted __be32 [usertype] *dst @@     got unsigned int * @@
>> drivers/firmware/turris-mox-rwtm.c:386:27: sparse:     expected restricted __be32 [usertype] *dst
>> drivers/firmware/turris-mox-rwtm.c:386:27: sparse:     got unsigned int *

vim +386 drivers/firmware/turris-mox-rwtm.c

   325	
   326	static ssize_t do_sign_write(struct file *file, const char __user *buf,
   327				     size_t len, loff_t *ppos)
   328	{
   329		struct mox_rwtm *rwtm = file->private_data;
   330		struct armada_37xx_rwtm_rx_msg *reply = &rwtm->reply;
   331		struct armada_37xx_rwtm_tx_msg msg;
   332		loff_t dummy = 0;
   333		ssize_t ret;
   334	
   335		/* the input is a SHA-512 hash, so exactly 64 bytes have to be read */
   336		if (len != 64)
   337			return -EINVAL;
   338	
   339		/* if last result is not zero user has not read that information yet */
   340		if (rwtm->last_sig_done)
   341			return -EBUSY;
   342	
   343		if (!mutex_trylock(&rwtm->busy))
   344			return -EBUSY;
   345	
   346		/*
   347		 * Here we have to send:
   348		 *   1. Address of the input to sign.
   349		 *      The input is an array of 17 32-bit words, the first (most
   350		 *      significat) is 0, the rest 16 words are copied from the SHA-512
   351		 *      hash given by the user and converted from BE to LE.
   352		 *   2. Address of the buffer where ECDSA signature value R shall be
   353		 *      stored by the rWTM firmware.
   354		 *   3. Address of the buffer where ECDSA signature value S shall be
   355		 *      stored by the rWTM firmware.
   356		 */
   357		memset(rwtm->buf, 0, 4);
   358		ret = simple_write_to_buffer(rwtm->buf + 4, 64, &dummy, buf, len);
   359		if (ret < 0)
   360			goto unlock_mutex;
   361		be32_to_cpu_array(rwtm->buf, rwtm->buf, 17);
   362	
   363		msg.command = MBOX_CMD_SIGN;
   364		msg.args[0] = 1;
   365		msg.args[1] = rwtm->buf_phys;
   366		msg.args[2] = rwtm->buf_phys + 68;
   367		msg.args[3] = rwtm->buf_phys + 2 * 68;
   368		ret = mbox_send_message(rwtm->mbox, &msg);
   369		if (ret < 0)
   370			goto unlock_mutex;
   371	
   372		ret = wait_for_completion_interruptible(&rwtm->cmd_done);
   373		if (ret < 0)
   374			goto unlock_mutex;
   375	
   376		ret = MBOX_STS_VALUE(reply->retval);
   377		if (MBOX_STS_ERROR(reply->retval) != MBOX_STS_SUCCESS)
   378			goto unlock_mutex;
   379	
   380		/*
   381		 * Here we read the R and S values of the ECDSA signature
   382		 * computed by the rWTM firmware and convert their words from
   383		 * LE to BE.
   384		 */
   385		memcpy(rwtm->last_sig, rwtm->buf + 68, 136);
 > 386		cpu_to_be32_array(rwtm->last_sig, rwtm->last_sig, 34);
   387		rwtm->last_sig_done = 1;
   388	
   389		mutex_unlock(&rwtm->busy);
   390		return len;
   391	unlock_mutex:
   392		mutex_unlock(&rwtm->busy);
   393		return ret;
   394	}
   395	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37704 bytes --]

                 reply	other threads:[~2020-07-30  3:31 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=202007301131.de0PExia%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.