usb: yurex: Replace snprintf() with the safer scnprintf() variant
BCC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Lee Jones <[email protected]>
Hi Lee,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Lee-Jones/usb-gadget-configfs-Replace-snprintf-with-the-safer-scnprintf-variant/20231214-004543 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20231213164246.1021885-9-lee%40kernel.org patch subject: [PATCH 08/12] usb: yurex: Replace snprintf() with the safer scnprintf() variant config: riscv-randconfig-r081-20231216 (https://download.01.org/0day-ci/archive/20231217/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
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
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/usb/misc/yurex.c:425 yurex_read() warn: inconsistent returns '&dev->io_mutex'.
vim +425 drivers/usb/misc/yurex.c
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 400
1cc373c654acde Sudip Mukherjee 2014-10-10 401 static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
1cc373c654acde Sudip Mukherjee 2014-10-10 402 loff_t *ppos)
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 403 {
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 404 struct usb_yurex *dev;
f1e255d60ae66a Jann Horn 2018-07-06 405 int len = 0;
d9c494521b9f1e Lee Jones 2023-12-13 406 char in_buffer[MAX_S64_STRLEN];
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 407 unsigned long flags;
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 408
113ad911ad4a1c Arjun Sreedharan 2014-08-19 409 dev = file->private_data;
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 410
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 411 mutex_lock(&dev->io_mutex);
aafb00a977cf7d Johan Hovold 2019-10-09 412 if (dev->disconnected) { /* already disconnected */
f1e255d60ae66a Jann Horn 2018-07-06 413 mutex_unlock(&dev->io_mutex);
f1e255d60ae66a Jann Horn 2018-07-06 414 return -ENODEV;
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 415 }
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 416
d9c494521b9f1e Lee Jones 2023-12-13 417 if (WARN_ON_ONCE(dev->bbu > S64_MAX || dev->bbu < S64_MIN))
d9c494521b9f1e Lee Jones 2023-12-13 418 return -EIO;
d9c494521b9f1e Lee Jones 2023-12-13 419
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 420 spin_lock_irqsave(&dev->lock, flags);
d9c494521b9f1e Lee Jones 2023-12-13 421 scnprintf(in_buffer, MAX_S64_STRLEN, "%lld\n", dev->bbu);
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 422 spin_unlock_irqrestore(&dev->lock, flags);
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 423 mutex_unlock(&dev->io_mutex);
f1e255d60ae66a Jann Horn 2018-07-06 424
f1e255d60ae66a Jann Horn 2018-07-06 @425 return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 426 }
6bc235a2e24a5e Tomoki Sekiyama 2010-09-29 427 Signature · 23 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki Date: Sat, 16 Dec 2023 12:20:38 -0800 From: Tree Davies <[email protected]> To: [email protected], [email protected], [email protected] Cc: [email protected], [email protected], Tree Davies <[email protected]> Subject: [PATCH] Staging: rtl8192e: rename linked list reference: List Message-Id: <[email protected]> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 Rename variable List to list, to fix Avoid CamelCase checkpatch warning. Signed-off-by: Tree Davies <[email protected]> --- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 78 +++++++++++------------ drivers/staging/rtl8192e/rtllib.h | 2 +- drivers/staging/rtl8192e/rtllib_rx.c | 30 ++++----- 4 files changed, 56 insertions(+), 56 deletions(-)
drivers/staging/rtl8192e/rtl819x_TS.h +1 -1
@@ -17,7 +17,7 @@ enum tr_select { };struct ts_common_info { -struct list_head List; +struct list_head list;u8 addr[ETH_ALEN ];struct qos_tsinfo tspec; };
drivers/staging/rtl8192e/rtl819x_TSProc.c +39 -39
194 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib.h +1 -1
@@ -1042,7 +1042,7 @@ struct bandwidth_autoswitch {#define REORDER_WIN_SIZE 128#define REORDER_ENTRY_NUM 128struct rx_reorder_entry { -struct list_head List; +struct list_head list;u16 SeqNum;struct rtllib_rxb *prxb; };
drivers/staging/rtl8192e/rtllib_rx.c +15 -15
@@ -412,19 +412,19 @@ static bool AddReorderEntry(struct rx_ts_record *ts,while (pList->next != &ts->rx_pending_pkt_list) {if (SN_LESS (pReorderEntry->SeqNum, ((struct rx_reorder_entry *) list_entry(pList->next, struct rx_reorder_entry, - List))->SeqNum)) + list))->SeqNum)) pList = pList->next;else if (SN_EQUAL (pReorderEntry->SeqNum, ((struct rx_reorder_entry *)list_entry (pList->next, - struct rx_reorder_entry, List))->SeqNum)) + struct rx_reorder_entry, list))->SeqNum))return false;else break ; } - pReorderEntry->List.next = pList->next; - pReorderEntry->List.next->prev = &pReorderEntry->List; - pReorderEntry->List.prev = pList; - pList->next = &pReorderEntry->List; + pReorderEntry->list.next = pList->next; + pReorderEntry->list.next->prev = &pReorderEntry->list; + pReorderEntry->list.prev = pList; + pList->next = &pReorderEntry->list;return true; }
@@ -505,15 +505,15 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, pRxReorderEntry = (struct rx_reorder_entry *)list_entry (ts->rx_pending_pkt_list.prev, - struct rx_reorder_entry, List); + struct rx_reorder_entry, list);netdev_dbg (ieee->dev,"%s(): Indicate SeqNum %d!\n" , __func__, pRxReorderEntry->SeqNum); -list_del_init (&pRxReorderEntry->List); +list_del_init (&pRxReorderEntry->list); ieee->RfdArray[RfdCnt] = pRxReorderEntry->prxb; RfdCnt = RfdCnt +1 ; -list_add_tail (&pRxReorderEntry->List, +list_add_tail (&pRxReorderEntry->list, &ieee->RxReorder_Unused_List); }rtllib_indicate_packets (ieee, ieee->RfdArray, RfdCnt);
@@ -602,8 +602,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,if (!list_empty (&ieee->RxReorder_Unused_List)) { pReorderEntry = (struct rx_reorder_entry *)list_entry (ieee->RxReorder_Unused_List.next, - struct rx_reorder_entry, List); -list_del_init (&pReorderEntry->List); + struct rx_reorder_entry, list); +list_del_init (&pReorderEntry->list);/* Make a reorder entry and insert * into a the packet list.
@@ -618,7 +618,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,"%s(): Duplicate packet is dropped. IndicateSeq: %d, NewSeq: %d\n" , __func__, ts->rx_indicate_seq, SeqNum); -list_add_tail (&pReorderEntry->List, +list_add_tail (&pReorderEntry->list, &ieee->RxReorder_Unused_List);for (i =0 ; i < prxb->nr_subframes; i++)
@@ -658,7 +658,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, pReorderEntry = (struct rx_reorder_entry *)list_entry (ts->rx_pending_pkt_list.prev, struct rx_reorder_entry, - List); + list);if (SN_LESS (pReorderEntry->SeqNum, ts->rx_indicate_seq) ||SN_EQUAL (pReorderEntry->SeqNum, ts->rx_indicate_seq)) {/* This protect struct buffer from overflow. */
@@ -670,7 +670,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,break ; } -list_del_init (&pReorderEntry->List); +list_del_init (&pReorderEntry->list);if (SN_EQUAL (pReorderEntry->SeqNum, ts->rx_indicate_seq)) ts->rx_indicate_seq = (ts->rx_indicate_seq + 1) %
@@ -681,7 +681,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, __func__, pReorderEntry->SeqNum); index++; -list_add_tail (&pReorderEntry->List, +list_add_tail (&pReorderEntry->list, &ieee->RxReorder_Unused_List); }else { bPktInBuf = true;
Signature · 1 line
2.39.2