All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/core: Fix BUG to BUG_ON conditionals.
@ 2017-10-08 19:17 Tim Hansen
  2017-10-08 20:03 ` [PATCH v2] " Tim Hansen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tim Hansen @ 2017-10-08 19:17 UTC (permalink / raw)
  To: davem
  Cc: willemb, edumazet, soheil, elena.reshetova, pabeni, tom, Jason,
	fw, netdev, linux-kernel, alexander.levin, devtimhansen

Fix BUG() calls to use BUG_ON(conditional) macros.

This was found using make coccicheck M=net/core on linux next
tag next-20170929.

Signed-off-by: Tim Hansen <devtimhansen@gmail.com>
---
 net/core/skbuff.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index d98c2e3ce2bf..461516f45b33 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1350,8 +1350,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
 	/* Set the tail pointer and length */
 	skb_put(n, skb->len);
 
-	if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))
-		BUG();
+	BUG_ON(skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len));
 
 	copy_skb_header(n, skb);
 	return n;
@@ -1449,8 +1448,7 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
 
 	BUG_ON(nhead < 0);
 
-	if (skb_shared(skb))
-		BUG();
+	BUG_ON(skb_shared(skb));
 
 	size = SKB_DATA_ALIGN(size);
 
@@ -1595,9 +1593,8 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
 		head_copy_off = newheadroom - head_copy_len;
 
 	/* Copy the linear header and data. */
-	if (skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
-			  skb->len + head_copy_len))
-		BUG();
+	BUG_ON(skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
+			     skb->len + head_copy_len));
 
 	copy_skb_header(n, skb);
 
@@ -1878,8 +1875,8 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta)
 			return NULL;
 	}
 
-	if (skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb), delta))
-		BUG();
+	BUG_ON(skb_copy_bits(skb, skb_headlen(skb),
+			     skb_tail_pointer(skb), delta))
 
 	/* Optimization: no fragments, no reasons to preestimate
 	 * size of pulled pages. Superb.
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] net/core: Fix BUG to BUG_ON conditionals.
  2017-10-08 19:17 [PATCH] net/core: Fix BUG to BUG_ON conditionals Tim Hansen
@ 2017-10-08 20:03 ` Tim Hansen
  2017-10-09  4:20   ` David Miller
  2017-10-08 23:52 ` [PATCH] " kbuild test robot
  2017-10-09  6:45 ` kbuild test robot
  2 siblings, 1 reply; 5+ messages in thread
From: Tim Hansen @ 2017-10-08 20:03 UTC (permalink / raw)
  To: davem
  Cc: willemb, edumazet, soheil, elena.reshetova, pabeni, tom, Jason,
	fw, netdev, linux-kernel, alexander.levin

Mistakenly sent the patch previously with a missing semicolon.
Apologies.

Fix BUG() calls to use BUG_ON(conditional) macros.

This was found using make coccicheck M=net/core on linux next
tag next-20170929

Signed-off-by: Tim Hansen <devtimhansen@gmail.com>
---
 net/core/skbuff.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index d98c2e3ce2bf..34ce4c1a0f3c 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1350,8 +1350,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
 	/* Set the tail pointer and length */
 	skb_put(n, skb->len);
 
-	if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))
-		BUG();
+	BUG_ON(skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len));
 
 	copy_skb_header(n, skb);
 	return n;
@@ -1449,8 +1448,7 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
 
 	BUG_ON(nhead < 0);
 
-	if (skb_shared(skb))
-		BUG();
+	BUG_ON(skb_shared(skb));
 
 	size = SKB_DATA_ALIGN(size);
 
@@ -1595,9 +1593,8 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
 		head_copy_off = newheadroom - head_copy_len;
 
 	/* Copy the linear header and data. */
-	if (skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
-			  skb->len + head_copy_len))
-		BUG();
+	BUG_ON(skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
+			     skb->len + head_copy_len));
 
 	copy_skb_header(n, skb);
 
@@ -1878,8 +1875,8 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta)
 			return NULL;
 	}
 
-	if (skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb), delta))
-		BUG();
+	BUG_ON(skb_copy_bits(skb, skb_headlen(skb),
+			     skb_tail_pointer(skb), delta));
 
 	/* Optimization: no fragments, no reasons to preestimate
 	 * size of pulled pages. Superb.
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net/core: Fix BUG to BUG_ON conditionals.
  2017-10-08 19:17 [PATCH] net/core: Fix BUG to BUG_ON conditionals Tim Hansen
  2017-10-08 20:03 ` [PATCH v2] " Tim Hansen
@ 2017-10-08 23:52 ` kbuild test robot
  2017-10-09  6:45 ` kbuild test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2017-10-08 23:52 UTC (permalink / raw)
  To: Tim Hansen
  Cc: kbuild-all, davem, willemb, edumazet, soheil, elena.reshetova,
	pabeni, tom, Jason, fw, netdev, linux-kernel, alexander.levin,
	devtimhansen

[-- Attachment #1: Type: text/plain, Size: 13088 bytes --]

Hi Tim,

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.14-rc3 next-20170929]
[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/Tim-Hansen/net-core-Fix-BUG-to-BUG_ON-conditionals/20171009-070451
config: blackfin-allyesconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

All errors (new ones prefixed by >>):

   net/core/skbuff.c: In function '__pskb_pull_tail':
>> net/core/skbuff.c:1884:2: error: expected ';' before 'if'
     if (!skb_has_frag_list(skb))
     ^~

vim +1884 net/core/skbuff.c

^1da177e4c Linus Torvalds           2005-04-16  1838  
^1da177e4c Linus Torvalds           2005-04-16  1839  /**
^1da177e4c Linus Torvalds           2005-04-16  1840   *	__pskb_pull_tail - advance tail of skb header
^1da177e4c Linus Torvalds           2005-04-16  1841   *	@skb: buffer to reallocate
^1da177e4c Linus Torvalds           2005-04-16  1842   *	@delta: number of bytes to advance tail
^1da177e4c Linus Torvalds           2005-04-16  1843   *
^1da177e4c Linus Torvalds           2005-04-16  1844   *	The function makes a sense only on a fragmented &sk_buff,
^1da177e4c Linus Torvalds           2005-04-16  1845   *	it expands header moving its tail forward and copying necessary
^1da177e4c Linus Torvalds           2005-04-16  1846   *	data from fragmented part.
^1da177e4c Linus Torvalds           2005-04-16  1847   *
^1da177e4c Linus Torvalds           2005-04-16  1848   *	&sk_buff MUST have reference count of 1.
^1da177e4c Linus Torvalds           2005-04-16  1849   *
^1da177e4c Linus Torvalds           2005-04-16  1850   *	Returns %NULL (and &sk_buff does not change) if pull failed
^1da177e4c Linus Torvalds           2005-04-16  1851   *	or value of new tail of skb in the case of success.
^1da177e4c Linus Torvalds           2005-04-16  1852   *
^1da177e4c Linus Torvalds           2005-04-16  1853   *	All the pointers pointing into skb header may change and must be
^1da177e4c Linus Torvalds           2005-04-16  1854   *	reloaded after call to this function.
^1da177e4c Linus Torvalds           2005-04-16  1855   */
^1da177e4c Linus Torvalds           2005-04-16  1856  
^1da177e4c Linus Torvalds           2005-04-16  1857  /* Moves tail of skb head forward, copying data from fragmented part,
^1da177e4c Linus Torvalds           2005-04-16  1858   * when it is necessary.
^1da177e4c Linus Torvalds           2005-04-16  1859   * 1. It may fail due to malloc failure.
^1da177e4c Linus Torvalds           2005-04-16  1860   * 2. It may change skb pointers.
^1da177e4c Linus Torvalds           2005-04-16  1861   *
^1da177e4c Linus Torvalds           2005-04-16  1862   * It is pretty complicated. Luckily, it is called only in exceptional cases.
^1da177e4c Linus Torvalds           2005-04-16  1863   */
af72868b90 Johannes Berg            2017-06-16  1864  void *__pskb_pull_tail(struct sk_buff *skb, int delta)
^1da177e4c Linus Torvalds           2005-04-16  1865  {
^1da177e4c Linus Torvalds           2005-04-16  1866  	/* If skb has not enough free space at tail, get new one
^1da177e4c Linus Torvalds           2005-04-16  1867  	 * plus 128 bytes for future expansions. If we have enough
^1da177e4c Linus Torvalds           2005-04-16  1868  	 * room at tail, reallocate without expansion only if skb is cloned.
^1da177e4c Linus Torvalds           2005-04-16  1869  	 */
4305b54135 Arnaldo Carvalho de Melo 2007-04-19  1870  	int i, k, eat = (skb->tail + delta) - skb->end;
^1da177e4c Linus Torvalds           2005-04-16  1871  
^1da177e4c Linus Torvalds           2005-04-16  1872  	if (eat > 0 || skb_cloned(skb)) {
^1da177e4c Linus Torvalds           2005-04-16  1873  		if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0,
^1da177e4c Linus Torvalds           2005-04-16  1874  				     GFP_ATOMIC))
^1da177e4c Linus Torvalds           2005-04-16  1875  			return NULL;
^1da177e4c Linus Torvalds           2005-04-16  1876  	}
^1da177e4c Linus Torvalds           2005-04-16  1877  
b4ef80dbcb Tim Hansen               2017-10-08  1878  	BUG_ON(skb_copy_bits(skb, skb_headlen(skb),
b4ef80dbcb Tim Hansen               2017-10-08  1879  			     skb_tail_pointer(skb), delta))
^1da177e4c Linus Torvalds           2005-04-16  1880  
^1da177e4c Linus Torvalds           2005-04-16  1881  	/* Optimization: no fragments, no reasons to preestimate
^1da177e4c Linus Torvalds           2005-04-16  1882  	 * size of pulled pages. Superb.
^1da177e4c Linus Torvalds           2005-04-16  1883  	 */
21dc330157 David S. Miller          2010-08-23 @1884  	if (!skb_has_frag_list(skb))
^1da177e4c Linus Torvalds           2005-04-16  1885  		goto pull_pages;
^1da177e4c Linus Torvalds           2005-04-16  1886  
^1da177e4c Linus Torvalds           2005-04-16  1887  	/* Estimate size of pulled pages. */
^1da177e4c Linus Torvalds           2005-04-16  1888  	eat = delta;
^1da177e4c Linus Torvalds           2005-04-16  1889  	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
9e903e0852 Eric Dumazet             2011-10-18  1890  		int size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
9e903e0852 Eric Dumazet             2011-10-18  1891  
9e903e0852 Eric Dumazet             2011-10-18  1892  		if (size >= eat)
^1da177e4c Linus Torvalds           2005-04-16  1893  			goto pull_pages;
9e903e0852 Eric Dumazet             2011-10-18  1894  		eat -= size;
^1da177e4c Linus Torvalds           2005-04-16  1895  	}
^1da177e4c Linus Torvalds           2005-04-16  1896  
^1da177e4c Linus Torvalds           2005-04-16  1897  	/* If we need update frag list, we are in troubles.
^1da177e4c Linus Torvalds           2005-04-16  1898  	 * Certainly, it possible to add an offset to skb data,
^1da177e4c Linus Torvalds           2005-04-16  1899  	 * but taking into account that pulling is expected to
^1da177e4c Linus Torvalds           2005-04-16  1900  	 * be very rare operation, it is worth to fight against
^1da177e4c Linus Torvalds           2005-04-16  1901  	 * further bloating skb head and crucify ourselves here instead.
^1da177e4c Linus Torvalds           2005-04-16  1902  	 * Pure masohism, indeed. 8)8)
^1da177e4c Linus Torvalds           2005-04-16  1903  	 */
^1da177e4c Linus Torvalds           2005-04-16  1904  	if (eat) {
^1da177e4c Linus Torvalds           2005-04-16  1905  		struct sk_buff *list = skb_shinfo(skb)->frag_list;
^1da177e4c Linus Torvalds           2005-04-16  1906  		struct sk_buff *clone = NULL;
^1da177e4c Linus Torvalds           2005-04-16  1907  		struct sk_buff *insp = NULL;
^1da177e4c Linus Torvalds           2005-04-16  1908  
^1da177e4c Linus Torvalds           2005-04-16  1909  		do {
09a626600b Kris Katterjohn          2006-01-08  1910  			BUG_ON(!list);
^1da177e4c Linus Torvalds           2005-04-16  1911  
^1da177e4c Linus Torvalds           2005-04-16  1912  			if (list->len <= eat) {
^1da177e4c Linus Torvalds           2005-04-16  1913  				/* Eaten as whole. */
^1da177e4c Linus Torvalds           2005-04-16  1914  				eat -= list->len;
^1da177e4c Linus Torvalds           2005-04-16  1915  				list = list->next;
^1da177e4c Linus Torvalds           2005-04-16  1916  				insp = list;
^1da177e4c Linus Torvalds           2005-04-16  1917  			} else {
^1da177e4c Linus Torvalds           2005-04-16  1918  				/* Eaten partially. */
^1da177e4c Linus Torvalds           2005-04-16  1919  
^1da177e4c Linus Torvalds           2005-04-16  1920  				if (skb_shared(list)) {
^1da177e4c Linus Torvalds           2005-04-16  1921  					/* Sucks! We need to fork list. :-( */
^1da177e4c Linus Torvalds           2005-04-16  1922  					clone = skb_clone(list, GFP_ATOMIC);
^1da177e4c Linus Torvalds           2005-04-16  1923  					if (!clone)
^1da177e4c Linus Torvalds           2005-04-16  1924  						return NULL;
^1da177e4c Linus Torvalds           2005-04-16  1925  					insp = list->next;
^1da177e4c Linus Torvalds           2005-04-16  1926  					list = clone;
^1da177e4c Linus Torvalds           2005-04-16  1927  				} else {
^1da177e4c Linus Torvalds           2005-04-16  1928  					/* This may be pulled without
^1da177e4c Linus Torvalds           2005-04-16  1929  					 * problems. */
^1da177e4c Linus Torvalds           2005-04-16  1930  					insp = list;
^1da177e4c Linus Torvalds           2005-04-16  1931  				}
^1da177e4c Linus Torvalds           2005-04-16  1932  				if (!pskb_pull(list, eat)) {
^1da177e4c Linus Torvalds           2005-04-16  1933  					kfree_skb(clone);
^1da177e4c Linus Torvalds           2005-04-16  1934  					return NULL;
^1da177e4c Linus Torvalds           2005-04-16  1935  				}
^1da177e4c Linus Torvalds           2005-04-16  1936  				break;
^1da177e4c Linus Torvalds           2005-04-16  1937  			}
^1da177e4c Linus Torvalds           2005-04-16  1938  		} while (eat);
^1da177e4c Linus Torvalds           2005-04-16  1939  
^1da177e4c Linus Torvalds           2005-04-16  1940  		/* Free pulled out fragments. */
^1da177e4c Linus Torvalds           2005-04-16  1941  		while ((list = skb_shinfo(skb)->frag_list) != insp) {
^1da177e4c Linus Torvalds           2005-04-16  1942  			skb_shinfo(skb)->frag_list = list->next;
^1da177e4c Linus Torvalds           2005-04-16  1943  			kfree_skb(list);
^1da177e4c Linus Torvalds           2005-04-16  1944  		}
^1da177e4c Linus Torvalds           2005-04-16  1945  		/* And insert new clone at head. */
^1da177e4c Linus Torvalds           2005-04-16  1946  		if (clone) {
^1da177e4c Linus Torvalds           2005-04-16  1947  			clone->next = list;
^1da177e4c Linus Torvalds           2005-04-16  1948  			skb_shinfo(skb)->frag_list = clone;
^1da177e4c Linus Torvalds           2005-04-16  1949  		}
^1da177e4c Linus Torvalds           2005-04-16  1950  	}
^1da177e4c Linus Torvalds           2005-04-16  1951  	/* Success! Now we may commit changes to skb data. */
^1da177e4c Linus Torvalds           2005-04-16  1952  
^1da177e4c Linus Torvalds           2005-04-16  1953  pull_pages:
^1da177e4c Linus Torvalds           2005-04-16  1954  	eat = delta;
^1da177e4c Linus Torvalds           2005-04-16  1955  	k = 0;
^1da177e4c Linus Torvalds           2005-04-16  1956  	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
9e903e0852 Eric Dumazet             2011-10-18  1957  		int size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
9e903e0852 Eric Dumazet             2011-10-18  1958  
9e903e0852 Eric Dumazet             2011-10-18  1959  		if (size <= eat) {
ea2ab69379 Ian Campbell             2011-08-22  1960  			skb_frag_unref(skb, i);
9e903e0852 Eric Dumazet             2011-10-18  1961  			eat -= size;
^1da177e4c Linus Torvalds           2005-04-16  1962  		} else {
^1da177e4c Linus Torvalds           2005-04-16  1963  			skb_shinfo(skb)->frags[k] = skb_shinfo(skb)->frags[i];
^1da177e4c Linus Torvalds           2005-04-16  1964  			if (eat) {
^1da177e4c Linus Torvalds           2005-04-16  1965  				skb_shinfo(skb)->frags[k].page_offset += eat;
9e903e0852 Eric Dumazet             2011-10-18  1966  				skb_frag_size_sub(&skb_shinfo(skb)->frags[k], eat);
3ccc6c6faa linzhang                 2017-07-17  1967  				if (!i)
3ccc6c6faa linzhang                 2017-07-17  1968  					goto end;
^1da177e4c Linus Torvalds           2005-04-16  1969  				eat = 0;
^1da177e4c Linus Torvalds           2005-04-16  1970  			}
^1da177e4c Linus Torvalds           2005-04-16  1971  			k++;
^1da177e4c Linus Torvalds           2005-04-16  1972  		}
^1da177e4c Linus Torvalds           2005-04-16  1973  	}
^1da177e4c Linus Torvalds           2005-04-16  1974  	skb_shinfo(skb)->nr_frags = k;
^1da177e4c Linus Torvalds           2005-04-16  1975  
3ccc6c6faa linzhang                 2017-07-17  1976  end:
^1da177e4c Linus Torvalds           2005-04-16  1977  	skb->tail     += delta;
^1da177e4c Linus Torvalds           2005-04-16  1978  	skb->data_len -= delta;
^1da177e4c Linus Torvalds           2005-04-16  1979  
1f8b977ab3 Willem de Bruijn         2017-08-03  1980  	if (!skb->data_len)
1f8b977ab3 Willem de Bruijn         2017-08-03  1981  		skb_zcopy_clear(skb, false);
1f8b977ab3 Willem de Bruijn         2017-08-03  1982  
27a884dc3c Arnaldo Carvalho de Melo 2007-04-19  1983  	return skb_tail_pointer(skb);
^1da177e4c Linus Torvalds           2005-04-16  1984  }
b4ac530fc3 David S. Miller          2009-02-10  1985  EXPORT_SYMBOL(__pskb_pull_tail);
^1da177e4c Linus Torvalds           2005-04-16  1986  

:::::: The code at line 1884 was first introduced by commit
:::::: 21dc330157454046dd7c494961277d76e1c957fe net: Rename skb_has_frags to skb_has_frag_list

:::::: TO: David S. Miller <davem@davemloft.net>
:::::: CC: David S. Miller <davem@davemloft.net>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 46057 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] net/core: Fix BUG to BUG_ON conditionals.
  2017-10-08 20:03 ` [PATCH v2] " Tim Hansen
@ 2017-10-09  4:20   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-10-09  4:20 UTC (permalink / raw)
  To: devtimhansen
  Cc: willemb, edumazet, soheil, elena.reshetova, pabeni, tom, Jason,
	fw, netdev, linux-kernel, alexander.levin

From: Tim Hansen <devtimhansen@gmail.com>
Date: Sun, 8 Oct 2017 16:03:38 -0400

> Mistakenly sent the patch previously with a missing semicolon.
> Apologies.
> 
> Fix BUG() calls to use BUG_ON(conditional) macros.
> 
> This was found using make coccicheck M=net/core on linux next
> tag next-20170929
> 
> Signed-off-by: Tim Hansen <devtimhansen@gmail.com>

You're going to have to submit this new version again, the way you
replied to the original patch caused the fixed version to not get
queued up in patchwork properly.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net/core: Fix BUG to BUG_ON conditionals.
  2017-10-08 19:17 [PATCH] net/core: Fix BUG to BUG_ON conditionals Tim Hansen
  2017-10-08 20:03 ` [PATCH v2] " Tim Hansen
  2017-10-08 23:52 ` [PATCH] " kbuild test robot
@ 2017-10-09  6:45 ` kbuild test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2017-10-09  6:45 UTC (permalink / raw)
  To: Tim Hansen
  Cc: kbuild-all, davem, willemb, edumazet, soheil, elena.reshetova,
	pabeni, tom, Jason, fw, netdev, linux-kernel, alexander.levin,
	devtimhansen

[-- Attachment #1: Type: text/plain, Size: 5990 bytes --]

Hi Tim,

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.14-rc4 next-20170929]
[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/Tim-Hansen/net-core-Fix-BUG-to-BUG_ON-conditionals/20171009-070451
config: x86_64-randconfig-s1-10091351 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from net//core/skbuff.c:41:
   net//core/skbuff.c: In function '__pskb_pull_tail':
>> include/linux/compiler.h:156:2: error: expected ';' before 'if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
>> net//core/skbuff.c:1884:2: note: in expansion of macro 'if'
     if (!skb_has_frag_list(skb))
     ^~
>> include/linux/compiler.h:170:3: error: expected statement before ')' token
     }))
      ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
>> net//core/skbuff.c:1884:2: note: in expansion of macro 'if'
     if (!skb_has_frag_list(skb))
     ^~
   include/linux/compiler.h:170:4: error: expected statement before ')' token
     }))
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
>> net//core/skbuff.c:1884:2: note: in expansion of macro 'if'
     if (!skb_has_frag_list(skb))
     ^~
--
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from net/core/skbuff.c:41:
   net/core/skbuff.c: In function '__pskb_pull_tail':
>> include/linux/compiler.h:156:2: error: expected ';' before 'if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
   net/core/skbuff.c:1884:2: note: in expansion of macro 'if'
     if (!skb_has_frag_list(skb))
     ^~
>> include/linux/compiler.h:170:3: error: expected statement before ')' token
     }))
      ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
   net/core/skbuff.c:1884:2: note: in expansion of macro 'if'
     if (!skb_has_frag_list(skb))
     ^~
   include/linux/compiler.h:170:4: error: expected statement before ')' token
     }))
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
   net/core/skbuff.c:1884:2: note: in expansion of macro 'if'
     if (!skb_has_frag_list(skb))
     ^~

vim +156 include/linux/compiler.h

2bcd521a Steven Rostedt 2008-11-21  148  
2bcd521a Steven Rostedt 2008-11-21  149  #ifdef CONFIG_PROFILE_ALL_BRANCHES
2bcd521a Steven Rostedt 2008-11-21  150  /*
2bcd521a Steven Rostedt 2008-11-21  151   * "Define 'is'", Bill Clinton
2bcd521a Steven Rostedt 2008-11-21  152   * "Define 'if'", Steven Rostedt
2bcd521a Steven Rostedt 2008-11-21  153   */
ab3c9c68 Linus Torvalds 2009-04-07  154  #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
ab3c9c68 Linus Torvalds 2009-04-07  155  #define __trace_if(cond) \
b33c8ff4 Arnd Bergmann  2016-02-12 @156  	if (__builtin_constant_p(!!(cond)) ? !!(cond) :			\
2bcd521a Steven Rostedt 2008-11-21  157  	({								\
2bcd521a Steven Rostedt 2008-11-21  158  		int ______r;						\
2bcd521a Steven Rostedt 2008-11-21  159  		static struct ftrace_branch_data			\
2bcd521a Steven Rostedt 2008-11-21  160  			__attribute__((__aligned__(4)))			\
2bcd521a Steven Rostedt 2008-11-21  161  			__attribute__((section("_ftrace_branch")))	\
2bcd521a Steven Rostedt 2008-11-21  162  			______f = {					\
2bcd521a Steven Rostedt 2008-11-21  163  				.func = __func__,			\
2bcd521a Steven Rostedt 2008-11-21  164  				.file = __FILE__,			\
2bcd521a Steven Rostedt 2008-11-21  165  				.line = __LINE__,			\
2bcd521a Steven Rostedt 2008-11-21  166  			};						\
2bcd521a Steven Rostedt 2008-11-21  167  		______r = !!(cond);					\
97e7e4f3 Witold Baryluk 2009-03-17  168  		______f.miss_hit[______r]++;					\
2bcd521a Steven Rostedt 2008-11-21  169  		______r;						\
2bcd521a Steven Rostedt 2008-11-21 @170  	}))
2bcd521a Steven Rostedt 2008-11-21  171  #endif /* CONFIG_PROFILE_ALL_BRANCHES */
2bcd521a Steven Rostedt 2008-11-21  172  

:::::: The code at line 156 was first introduced by commit
:::::: b33c8ff4431a343561e2319f17c14286f2aa52e2 tracing: Fix freak link error caused by branch tracer

:::::: TO: Arnd Bergmann <arnd@arndb.de>
:::::: CC: Steven Rostedt <rostedt@goodmis.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29136 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-09  6:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08 19:17 [PATCH] net/core: Fix BUG to BUG_ON conditionals Tim Hansen
2017-10-08 20:03 ` [PATCH v2] " Tim Hansen
2017-10-09  4:20   ` David Miller
2017-10-08 23:52 ` [PATCH] " kbuild test robot
2017-10-09  6:45 ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.