mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Simon Richter <Simon.Richter@hogyros.de>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: drivers/nfc/microread/microread.c:489:26: sparse: sparse: cast to restricted __be16
Date: Fri, 18 Sep 2026 08:07:36 +0800	[thread overview]
Message-ID: <202609180724.WqXUgoWn-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9b87fdc9af2fbfcdb5c24a64139685ef80f6573f
commit: 25f9b0d351552f63ac3f72e6c655bc8f9994f7d2 misc/mei: Allow building Intel ME interface on non-x86
date:   8 months ago
config: powerpc-randconfig-r1308-20260917 (https://download.01.org/0day-ci/archive/20260918/202609180724.WqXUgoWn-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 148ee2b266b73a49f1f31d0bd17d4818b91bee9f)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260918/202609180724.WqXUgoWn-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
| Fixes: 25f9b0d35155 ("misc/mei: Allow building Intel ME interface on non-x86")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609180724.WqXUgoWn-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/nfc/microread/microread.c:489:26: sparse: sparse: cast to restricted __be16
   drivers/nfc/microread/microread.c:503:26: sparse: sparse: cast to restricted __be16
   drivers/nfc/microread/microread.c:521:25: sparse: sparse: cast to restricted __le16

vim +489 drivers/nfc/microread/microread.c

cfad1ba87150e19 Eric Lapuyade 2012-12-18  467  
cfad1ba87150e19 Eric Lapuyade 2012-12-18  468  static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate,
cfad1ba87150e19 Eric Lapuyade 2012-12-18  469  					struct sk_buff *skb)
cfad1ba87150e19 Eric Lapuyade 2012-12-18  470  {
cfad1ba87150e19 Eric Lapuyade 2012-12-18  471  	struct nfc_target *targets;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  472  	int r = 0;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  473  
cfad1ba87150e19 Eric Lapuyade 2012-12-18  474  	pr_info("target discovered to gate 0x%x\n", gate);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  475  
cfad1ba87150e19 Eric Lapuyade 2012-12-18  476  	targets = kzalloc(sizeof(struct nfc_target), GFP_KERNEL);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  477  	if (targets == NULL) {
cfad1ba87150e19 Eric Lapuyade 2012-12-18  478  		r = -ENOMEM;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  479  		goto exit;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  480  	}
cfad1ba87150e19 Eric Lapuyade 2012-12-18  481  
cfad1ba87150e19 Eric Lapuyade 2012-12-18  482  	targets->hci_reader_gate = gate;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  483  
cfad1ba87150e19 Eric Lapuyade 2012-12-18  484  	switch (gate) {
cfad1ba87150e19 Eric Lapuyade 2012-12-18  485  	case MICROREAD_GATE_ID_MREAD_ISO_A:
cfad1ba87150e19 Eric Lapuyade 2012-12-18  486  		targets->supported_protocols =
cfad1ba87150e19 Eric Lapuyade 2012-12-18  487  		      nfc_hci_sak_to_protocol(skb->data[MICROREAD_EMCF_A_SAK]);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  488  		targets->sens_res =
cfad1ba87150e19 Eric Lapuyade 2012-12-18 @489  			 be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A_ATQA]);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  490  		targets->sel_res = skb->data[MICROREAD_EMCF_A_SAK];
cfad1ba87150e19 Eric Lapuyade 2012-12-18  491  		targets->nfcid1_len = skb->data[MICROREAD_EMCF_A_LEN];
d07f1e8600ccb88 Dan Carpenter 2014-09-01  492  		if (targets->nfcid1_len > sizeof(targets->nfcid1)) {
d07f1e8600ccb88 Dan Carpenter 2014-09-01  493  			r = -EINVAL;
d07f1e8600ccb88 Dan Carpenter 2014-09-01  494  			goto exit_free;
d07f1e8600ccb88 Dan Carpenter 2014-09-01  495  		}
d07f1e8600ccb88 Dan Carpenter 2014-09-01  496  		memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A_UID],
d07f1e8600ccb88 Dan Carpenter 2014-09-01  497  		       targets->nfcid1_len);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  498  		break;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  499  	case MICROREAD_GATE_ID_MREAD_ISO_A_3:
cfad1ba87150e19 Eric Lapuyade 2012-12-18  500  		targets->supported_protocols =
cfad1ba87150e19 Eric Lapuyade 2012-12-18  501  		      nfc_hci_sak_to_protocol(skb->data[MICROREAD_EMCF_A3_SAK]);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  502  		targets->sens_res =
cfad1ba87150e19 Eric Lapuyade 2012-12-18  503  			 be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  504  		targets->sel_res = skb->data[MICROREAD_EMCF_A3_SAK];
cfad1ba87150e19 Eric Lapuyade 2012-12-18  505  		targets->nfcid1_len = skb->data[MICROREAD_EMCF_A3_LEN];
d07f1e8600ccb88 Dan Carpenter 2014-09-01  506  		if (targets->nfcid1_len > sizeof(targets->nfcid1)) {
d07f1e8600ccb88 Dan Carpenter 2014-09-01  507  			r = -EINVAL;
d07f1e8600ccb88 Dan Carpenter 2014-09-01  508  			goto exit_free;
d07f1e8600ccb88 Dan Carpenter 2014-09-01  509  		}
d07f1e8600ccb88 Dan Carpenter 2014-09-01  510  		memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A3_UID],
d07f1e8600ccb88 Dan Carpenter 2014-09-01  511  		       targets->nfcid1_len);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  512  		break;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  513  	case MICROREAD_GATE_ID_MREAD_ISO_B:
cfad1ba87150e19 Eric Lapuyade 2012-12-18  514  		targets->supported_protocols = NFC_PROTO_ISO14443_B_MASK;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  515  		memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_B_UID], 4);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  516  		targets->nfcid1_len = 4;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  517  		break;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  518  	case MICROREAD_GATE_ID_MREAD_NFC_T1:
cfad1ba87150e19 Eric Lapuyade 2012-12-18  519  		targets->supported_protocols = NFC_PROTO_JEWEL_MASK;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  520  		targets->sens_res =
cfad1ba87150e19 Eric Lapuyade 2012-12-18  521  			le16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_T1_ATQA]);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  522  		memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_T1_UID], 4);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  523  		targets->nfcid1_len = 4;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  524  		break;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  525  	case MICROREAD_GATE_ID_MREAD_NFC_T3:
cfad1ba87150e19 Eric Lapuyade 2012-12-18  526  		targets->supported_protocols = NFC_PROTO_FELICA_MASK;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  527  		memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_T3_UID], 8);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  528  		targets->nfcid1_len = 8;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  529  		break;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  530  	default:
cfad1ba87150e19 Eric Lapuyade 2012-12-18  531  		pr_info("discard target discovered to gate 0x%x\n", gate);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  532  		goto exit_free;
cfad1ba87150e19 Eric Lapuyade 2012-12-18  533  	}
cfad1ba87150e19 Eric Lapuyade 2012-12-18  534  
cfad1ba87150e19 Eric Lapuyade 2012-12-18  535  	r = nfc_targets_found(hdev->ndev, targets, 1);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  536  
cfad1ba87150e19 Eric Lapuyade 2012-12-18  537  exit_free:
cfad1ba87150e19 Eric Lapuyade 2012-12-18  538  	kfree(targets);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  539  
cfad1ba87150e19 Eric Lapuyade 2012-12-18  540  exit:
cfad1ba87150e19 Eric Lapuyade 2012-12-18  541  	kfree_skb(skb);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  542  
cfad1ba87150e19 Eric Lapuyade 2012-12-18  543  	if (r)
17936b43f0fdede Joe Perches   2013-04-05  544  		pr_err("Failed to handle discovered target err=%d\n", r);
cfad1ba87150e19 Eric Lapuyade 2012-12-18  545  }
cfad1ba87150e19 Eric Lapuyade 2012-12-18  546  

:::::: The code at line 489 was first introduced by commit
:::::: cfad1ba87150e198be9ea32367a24e500e59de2c NFC: Initial support for Inside Secure microread

:::::: TO: Eric Lapuyade <eric.lapuyade@linux.intel.com>
:::::: CC: Samuel Ortiz <sameo@linux.intel.com>

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

                 reply	other threads:[~2026-09-18  0:08 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=202609180724.WqXUgoWn-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Simon.Richter@hogyros.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®