Re: [PATCH v10 5/7] nfc: pn533: add UART phy driver

From: kbuild test robot
Date: Mon Oct 28 2019 - 13:23:03 EST


Hi Lars,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.4-rc5 next-20191028]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Lars-Poeschel/nfc-pn533-add-uart-phy-driver/20191028-222313
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0365fb6baeb1ebefbbdad9e3f48bab9b3ccb8df3
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> drivers/nfc/pn533/uart.c:174:35: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] frame_len @@ got resunsigned short [usertype] frame_len @@
>> drivers/nfc/pn533/uart.c:174:35: sparse: expected unsigned short [usertype] frame_len
>> drivers/nfc/pn533/uart.c:174:35: sparse: got restricted __be16 [usertype] datalen

vim +174 drivers/nfc/pn533/uart.c

133
134 /*
135 * scans the buffer if it contains a pn532 frame. It is not checked if the
136 * frame is really valid. This is later done with pn533_rx_frame_is_valid.
137 * This is useful for malformed or errornous transmitted frames. Adjusts the
138 * bufferposition where the frame starts, since pn533_recv_frame expects a
139 * well formed frame.
140 */
141 static int pn532_uart_rx_is_frame(struct sk_buff *skb)
142 {
143 struct pn533_std_frame *std;
144 struct pn533_ext_frame *ext;
145 u16 frame_len;
146 int i;
147
148 for (i = 0; i + PN533_STD_FRAME_ACK_SIZE <= skb->len; i++) {
149 std = (struct pn533_std_frame *)&skb->data[i];
150 /* search start code */
151 if (std->start_frame != cpu_to_be16(PN533_STD_FRAME_SOF))
152 continue;
153
154 /* frame type */
155 switch (std->datalen) {
156 case PN533_FRAME_DATALEN_ACK:
157 if (std->datalen_checksum == 0xff) {
158 skb_pull(skb, i);
159 return 1;
160 }
161
162 break;
163 case PN533_FRAME_DATALEN_ERROR:
164 if ((std->datalen_checksum == 0xff) &&
165 (skb->len >=
166 PN533_STD_ERROR_FRAME_SIZE)) {
167 skb_pull(skb, i);
168 return 1;
169 }
170
171 break;
172 case PN533_FRAME_DATALEN_EXTENDED:
173 ext = (struct pn533_ext_frame *)&skb->data[i];
> 174 frame_len = ext->datalen;
175 if (skb->len >= frame_len +
176 sizeof(struct pn533_ext_frame) +
177 2 /* CKS + Postamble */) {
178 skb_pull(skb, i);
179 return 1;
180 }
181
182 break;
183 default: /* normal information frame */
184 frame_len = std->datalen;
185 if (skb->len >= frame_len +
186 sizeof(struct pn533_std_frame) +
187 2 /* CKS + Postamble */) {
188 skb_pull(skb, i);
189 return 1;
190 }
191
192 break;
193 }
194 }
195
196 return 0;
197 }
198

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