Message ID | 20210731085429.510245-1-jordy@pwning.systems (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | atm: [nicstar] make drain_scq explicitly unsigned | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 3 of 3 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | fail | Errors and warnings before: 46 this patch: 7 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: Prefer using '"%s...", __func__' to using 'drain_scq', this function's name, in a string |
netdev/build_allmodconfig_warn | fail | Errors and warnings before: 46 this patch: 7 |
netdev/header_inline | success | Link |
On Sat, 31 Jul 2021 10:54:28 +0200 Jordy Zomer wrote: > The drain_scq function used to take a signed integer as a pos parameter. > The only caller of this function passes an unsigned integer to it. > Therefore to make it obviously safe, let's just make this an unsgined > integer as this is used in pointer arithmetics. > > Signed-off-by: Jordy Zomer <jordy@pwning.systems> Does not build.
Hi Jordy, Thank you for the patch! Yet something to improve: [auto build test ERROR on net/master] [also build test ERROR on horms-ipvs/master net-next/master linus/master v5.15-rc3 next-20210922] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jordy-Zomer/atm-nicstar-make-drain_scq-explicitly-unsigned/20210929-153719 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git f936bb42aeb94a069bec7c9e04100d199c372956 config: i386-randconfig-a002-20210929 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/19ac2516740923c5cba92b42baa45c09c69e260f git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jordy-Zomer/atm-nicstar-make-drain_scq-explicitly-unsigned/20210929-153719 git checkout 19ac2516740923c5cba92b42baa45c09c69e260f # save the attached .config to linux build tree mkdir build_dir make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/atm/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All error/warnings (new ones prefixed by >>): >> drivers/atm/nicstar.c:1920:13: error: conflicting types for 'drain_scq' 1920 | static void drain_scq(ns_dev *card, scq_info *scq, unsigned int pos) | ^~~~~~~~~ drivers/atm/nicstar.c:137:13: note: previous declaration of 'drain_scq' was here 137 | static void drain_scq(ns_dev * card, scq_info * scq, int pos); | ^~~~~~~~~ >> drivers/atm/nicstar.c:137:13: warning: 'drain_scq' used but never defined drivers/atm/nicstar.c:1920:13: warning: 'drain_scq' defined but not used [-Wunused-function] 1920 | static void drain_scq(ns_dev *card, scq_info *scq, unsigned int pos) | ^~~~~~~~~ vim +/drain_scq +1920 drivers/atm/nicstar.c 1919 > 1920 static void drain_scq(ns_dev *card, scq_info *scq, unsigned int pos) 1921 { 1922 struct atm_vcc *vcc; 1923 struct sk_buff *skb; 1924 unsigned int i; 1925 unsigned long flags; 1926 1927 XPRINTK("nicstar%d: drain_scq() called, scq at 0x%p, pos %u.\n", 1928 card->index, scq, pos); 1929 if (pos >= scq->num_entries) { 1930 printk("nicstar%d: Bad index on drain_scq().\n", card->index); 1931 return; 1932 } 1933 1934 spin_lock_irqsave(&scq->lock, flags); 1935 i = (unsigned int)(scq->tail - scq->base); 1936 if (++i == scq->num_entries) 1937 i = 0; 1938 while (i != pos) { 1939 skb = scq->skb[i]; 1940 XPRINTK("nicstar%d: freeing skb at 0x%p (index %u).\n", 1941 card->index, skb, i); 1942 if (skb != NULL) { 1943 dma_unmap_single(&card->pcidev->dev, 1944 NS_PRV_DMA(skb), 1945 skb->len, 1946 DMA_TO_DEVICE); 1947 vcc = ATM_SKB(skb)->vcc; 1948 if (vcc && vcc->pop != NULL) { 1949 vcc->pop(vcc, skb); 1950 } else { 1951 dev_kfree_skb_irq(skb); 1952 } 1953 scq->skb[i] = NULL; 1954 } 1955 if (++i == scq->num_entries) 1956 i = 0; 1957 } 1958 scq->tail = scq->base + pos; 1959 spin_unlock_irqrestore(&scq->lock, flags); 1960 } 1961 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Jordy, Thank you for the patch! Yet something to improve: [auto build test ERROR on net/master] [also build test ERROR on horms-ipvs/master net-next/master linus/master v5.15-rc3 next-20210922] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jordy-Zomer/atm-nicstar-make-drain_scq-explicitly-unsigned/20210929-153719 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git f936bb42aeb94a069bec7c9e04100d199c372956 config: i386-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/19ac2516740923c5cba92b42baa45c09c69e260f git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jordy-Zomer/atm-nicstar-make-drain_scq-explicitly-unsigned/20210929-153719 git checkout 19ac2516740923c5cba92b42baa45c09c69e260f # save the attached .config to linux build tree make W=1 ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/atm/nicstar.c:1920:13: error: conflicting types for 'drain_scq' 1920 | static void drain_scq(ns_dev *card, scq_info *scq, unsigned int pos) | ^~~~~~~~~ drivers/atm/nicstar.c:137:13: note: previous declaration of 'drain_scq' was here 137 | static void drain_scq(ns_dev * card, scq_info * scq, int pos); | ^~~~~~~~~ drivers/atm/nicstar.c:137:13: error: 'drain_scq' used but never defined [-Werror] >> drivers/atm/nicstar.c:1920:13: error: 'drain_scq' defined but not used [-Werror=unused-function] 1920 | static void drain_scq(ns_dev *card, scq_info *scq, unsigned int pos) | ^~~~~~~~~ cc1: all warnings being treated as errors vim +/drain_scq +1920 drivers/atm/nicstar.c 1919 > 1920 static void drain_scq(ns_dev *card, scq_info *scq, unsigned int pos) 1921 { 1922 struct atm_vcc *vcc; 1923 struct sk_buff *skb; 1924 unsigned int i; 1925 unsigned long flags; 1926 1927 XPRINTK("nicstar%d: drain_scq() called, scq at 0x%p, pos %u.\n", 1928 card->index, scq, pos); 1929 if (pos >= scq->num_entries) { 1930 printk("nicstar%d: Bad index on drain_scq().\n", card->index); 1931 return; 1932 } 1933 1934 spin_lock_irqsave(&scq->lock, flags); 1935 i = (unsigned int)(scq->tail - scq->base); 1936 if (++i == scq->num_entries) 1937 i = 0; 1938 while (i != pos) { 1939 skb = scq->skb[i]; 1940 XPRINTK("nicstar%d: freeing skb at 0x%p (index %u).\n", 1941 card->index, skb, i); 1942 if (skb != NULL) { 1943 dma_unmap_single(&card->pcidev->dev, 1944 NS_PRV_DMA(skb), 1945 skb->len, 1946 DMA_TO_DEVICE); 1947 vcc = ATM_SKB(skb)->vcc; 1948 if (vcc && vcc->pop != NULL) { 1949 vcc->pop(vcc, skb); 1950 } else { 1951 dev_kfree_skb_irq(skb); 1952 } 1953 scq->skb[i] = NULL; 1954 } 1955 if (++i == scq->num_entries) 1956 i = 0; 1957 } 1958 scq->tail = scq->base + pos; 1959 spin_unlock_irqrestore(&scq->lock, flags); 1960 } 1961 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c index bc5a6ab6fa4b..530683972f16 100644 --- a/drivers/atm/nicstar.c +++ b/drivers/atm/nicstar.c @@ -1917,14 +1917,14 @@ static void process_tsq(ns_dev * card) card->membase + TSQH); } -static void drain_scq(ns_dev * card, scq_info * scq, int pos) +static void drain_scq(ns_dev *card, scq_info *scq, unsigned int pos) { struct atm_vcc *vcc; struct sk_buff *skb; - int i; + unsigned int i; unsigned long flags; - XPRINTK("nicstar%d: drain_scq() called, scq at 0x%p, pos %d.\n", + XPRINTK("nicstar%d: drain_scq() called, scq at 0x%p, pos %u.\n", card->index, scq, pos); if (pos >= scq->num_entries) { printk("nicstar%d: Bad index on drain_scq().\n", card->index); @@ -1932,12 +1932,12 @@ static void drain_scq(ns_dev * card, scq_info * scq, int pos) } spin_lock_irqsave(&scq->lock, flags); - i = (int)(scq->tail - scq->base); + i = (unsigned int)(scq->tail - scq->base); if (++i == scq->num_entries) i = 0; while (i != pos) { skb = scq->skb[i]; - XPRINTK("nicstar%d: freeing skb at 0x%p (index %d).\n", + XPRINTK("nicstar%d: freeing skb at 0x%p (index %u).\n", card->index, skb, i); if (skb != NULL) { dma_unmap_single(&card->pcidev->dev,
The drain_scq function used to take a signed integer as a pos parameter. The only caller of this function passes an unsigned integer to it. Therefore to make it obviously safe, let's just make this an unsgined integer as this is used in pointer arithmetics. Signed-off-by: Jordy Zomer <jordy@pwning.systems> --- drivers/atm/nicstar.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)