All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 10881/13550] drivers/mailbox/mailbox-mpfs.c:122 mpfs_mbox_send_data() warn: right shifting more than type allows 32 vs 4294967295
Date: Sat, 26 Jun 2021 08:49:41 +0800	[thread overview]
Message-ID: <202106260837.R2rmMbeR-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Conor Dooley <conor.dooley@microchip.com>
CC: Jassi Brar <jaswinder.singh@linaro.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8702f95941c215501826ea8743a8b64b83479209
commit: de5473936808627fa98c3d2e8e3fa3076338f601 [10881/13550] mbox: add polarfire soc system controller mailbox
:::::: branch date: 13 hours ago
:::::: commit date: 5 days ago
config: parisc-randconfig-m031-20210625 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/mailbox/mailbox-mpfs.c:122 mpfs_mbox_send_data() warn: right shifting more than type allows 32 vs 4294967295

vim +122 drivers/mailbox/mailbox-mpfs.c

de5473936808627 Conor Dooley 2021-05-11   80  
de5473936808627 Conor Dooley 2021-05-11   81  static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data)
de5473936808627 Conor Dooley 2021-05-11   82  {
de5473936808627 Conor Dooley 2021-05-11   83  	struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv;
de5473936808627 Conor Dooley 2021-05-11   84  	struct mpfs_mss_msg *msg = data;
de5473936808627 Conor Dooley 2021-05-11   85  	u32 tx_trigger;
de5473936808627 Conor Dooley 2021-05-11   86  	u16 opt_sel;
de5473936808627 Conor Dooley 2021-05-11   87  	u32 val = 0u;
de5473936808627 Conor Dooley 2021-05-11   88  
de5473936808627 Conor Dooley 2021-05-11   89  	mbox->response = msg->response;
de5473936808627 Conor Dooley 2021-05-11   90  	mbox->resp_offset = msg->resp_offset;
de5473936808627 Conor Dooley 2021-05-11   91  
de5473936808627 Conor Dooley 2021-05-11   92  	if (mpfs_mbox_busy(mbox))
de5473936808627 Conor Dooley 2021-05-11   93  		return -EBUSY;
de5473936808627 Conor Dooley 2021-05-11   94  
de5473936808627 Conor Dooley 2021-05-11   95  	if (msg->cmd_data_size) {
de5473936808627 Conor Dooley 2021-05-11   96  		u32 index;
de5473936808627 Conor Dooley 2021-05-11   97  		u8 extra_bits = msg->cmd_data_size & 3;
de5473936808627 Conor Dooley 2021-05-11   98  		u32 *word_buf = (u32 *)msg->cmd_data;
de5473936808627 Conor Dooley 2021-05-11   99  
de5473936808627 Conor Dooley 2021-05-11  100  		for (index = 0; index < (msg->cmd_data_size / 4); index++)
de5473936808627 Conor Dooley 2021-05-11  101  			writel_relaxed(word_buf[index],
de5473936808627 Conor Dooley 2021-05-11  102  				       mbox->mbox_base + MAILBOX_REG_OFFSET + index * 0x4);
de5473936808627 Conor Dooley 2021-05-11  103  		if (extra_bits) {
de5473936808627 Conor Dooley 2021-05-11  104  			u8 i;
de5473936808627 Conor Dooley 2021-05-11  105  			u8 byte_off = ALIGN_DOWN(msg->cmd_data_size, 4);
de5473936808627 Conor Dooley 2021-05-11  106  			u8 *byte_buf = msg->cmd_data + byte_off;
de5473936808627 Conor Dooley 2021-05-11  107  
de5473936808627 Conor Dooley 2021-05-11  108  			val = readl_relaxed(mbox->mbox_base +
de5473936808627 Conor Dooley 2021-05-11  109  					    MAILBOX_REG_OFFSET + index * 0x4);
de5473936808627 Conor Dooley 2021-05-11  110  
de5473936808627 Conor Dooley 2021-05-11  111  			for (i = 0u; i < extra_bits; i++) {
de5473936808627 Conor Dooley 2021-05-11  112  				val &= ~(0xffu << (i * 8u));
de5473936808627 Conor Dooley 2021-05-11  113  				val |= (byte_buf[i] << (i * 8u));
de5473936808627 Conor Dooley 2021-05-11  114  			}
de5473936808627 Conor Dooley 2021-05-11  115  
de5473936808627 Conor Dooley 2021-05-11  116  			writel_relaxed(val,
de5473936808627 Conor Dooley 2021-05-11  117  				       mbox->mbox_base + MAILBOX_REG_OFFSET + index * 0x4);
de5473936808627 Conor Dooley 2021-05-11  118  		}
de5473936808627 Conor Dooley 2021-05-11  119  	}
de5473936808627 Conor Dooley 2021-05-11  120  
de5473936808627 Conor Dooley 2021-05-11  121  	opt_sel = ((msg->mbox_offset << 7u) | (msg->cmd_opcode & 0x7fu));
de5473936808627 Conor Dooley 2021-05-11 @122  	tx_trigger = (opt_sel << SCB_CTRL_POS) & SCB_CTRL_MASK;
de5473936808627 Conor Dooley 2021-05-11  123  	tx_trigger |= SCB_CTRL_REQ_MASK | SCB_STATUS_NOTIFY_MASK;
de5473936808627 Conor Dooley 2021-05-11  124  	writel_relaxed(tx_trigger, mbox->mbox_base + SERVICES_CR_OFFSET);
de5473936808627 Conor Dooley 2021-05-11  125  
de5473936808627 Conor Dooley 2021-05-11  126  	return 0;
de5473936808627 Conor Dooley 2021-05-11  127  }
de5473936808627 Conor Dooley 2021-05-11  128  

---
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: 25243 bytes --]

                 reply	other threads:[~2021-06-26  0:49 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=202106260837.R2rmMbeR-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@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.