Message ID | 20180517164004.GA8413@kroah.com (mailing list archive) |
---|---|
State | Deferred |
Delegated to: | Samuel Ortiz |
Headers | show |
Hi Greg, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.17-rc5 next-20180517] [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/Greg-KH/NFC-pn533-don-t-send-USB-data-off-of-the-stack/20180518-100416 config: i386-randconfig-x013-201819 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/nfc/pn533/usb.c: In function 'pn533_usb_send_ack': >> drivers/nfc/pn533/usb.c:163:15: error: invalid operands to binary | (have 'struct urb *' and 'int') phy->out_urb |= URB_FREE_BUFFER; ^~ drivers/nfc/pn533/usb.c: In function 'pn533_usb_send_frame': drivers/nfc/pn533/usb.c:180:15: error: invalid operands to binary & (have 'struct urb *' and 'int') phy->out_urb &= ~URB_FREE_BUFFER; ^~ drivers/nfc/pn533/usb.c: In function 'pn533_acr122_poweron_rdr': drivers/nfc/pn533/usb.c:406:15: error: invalid operands to binary | (have 'struct urb *' and 'int') phy->out_urb |= URB_FREE_BUFFER; ^~ vim +163 drivers/nfc/pn533/usb.c 147 148 static int pn533_usb_send_ack(struct pn533 *dev, gfp_t flags) 149 { 150 struct pn533_usb_phy *phy = dev->phy; 151 static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; 152 /* spec 7.1.1.3: Preamble, SoPC (2), ACK Code (2), Postamble */ 153 char *buffer; 154 int rc; 155 156 buffer = kmalloc(sizeof(ack), GFP_KERNEL); 157 if (!buffer) 158 return -ENOMEM; 159 memcpy(buffer, ack, sizeof(ack)); 160 161 phy->out_urb->transfer_buffer = (u8 *)ack; 162 phy->out_urb->transfer_buffer_length = sizeof(ack); > 163 phy->out_urb |= URB_FREE_BUFFER; 164 rc = usb_submit_urb(phy->out_urb, flags); 165 166 return rc; 167 } 168 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c index e153e8b64bb8..15291cc4f4b5 100644 --- a/drivers/nfc/pn533/usb.c +++ b/drivers/nfc/pn533/usb.c @@ -150,10 +150,17 @@ static int pn533_usb_send_ack(struct pn533 *dev, gfp_t flags) struct pn533_usb_phy *phy = dev->phy; static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; /* spec 7.1.1.3: Preamble, SoPC (2), ACK Code (2), Postamble */ + char *buffer; int rc; + buffer = kmalloc(sizeof(ack), GFP_KERNEL); + if (!buffer) + return -ENOMEM; + memcpy(buffer, ack, sizeof(ack)); + phy->out_urb->transfer_buffer = (u8 *)ack; phy->out_urb->transfer_buffer_length = sizeof(ack); + phy->out_urb |= URB_FREE_BUFFER; rc = usb_submit_urb(phy->out_urb, flags); return rc; @@ -170,6 +177,7 @@ static int pn533_usb_send_frame(struct pn533 *dev, phy->out_urb->transfer_buffer = out->data; phy->out_urb->transfer_buffer_length = out->len; + phy->out_urb &= ~URB_FREE_BUFFER; print_hex_dump_debug("PN533 TX: ", DUMP_PREFIX_NONE, 16, 1, out->data, out->len, false); @@ -375,12 +383,18 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy) /* Power on th reader (CCID cmd) */ u8 cmd[10] = {PN533_ACR122_PC_TO_RDR_ICCPOWERON, 0, 0, 0, 0, 0, 0, 3, 0, 0}; + char *buffer; int rc; void *cntx; struct pn533_acr122_poweron_rdr_arg arg; dev_dbg(&phy->udev->dev, "%s\n", __func__); + buffer = kmalloc(sizeof(cmd), GFP_KERNEL); + if (!buffer) + return -ENOMEM; + memcpy(buffer, cmd, sizeof(cmd)); + init_completion(&arg.done); cntx = phy->in_urb->context; /* backup context */ @@ -389,6 +403,7 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy) phy->out_urb->transfer_buffer = cmd; phy->out_urb->transfer_buffer_length = sizeof(cmd); + phy->out_urb |= URB_FREE_BUFFER; print_hex_dump_debug("ACR122 TX: ", DUMP_PREFIX_NONE, 16, 1, cmd, sizeof(cmd), false);