[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201710090734.STN1jebQ%fengguang.wu@intel.com>
Date: Mon, 9 Oct 2017 07:52:04 +0800
From: kbuild test robot <lkp@...el.com>
To: Tim Hansen <devtimhansen@...il.com>
Cc: kbuild-all@...org, davem@...emloft.net, willemb@...gle.com,
edumazet@...gle.com, soheil@...gle.com, elena.reshetova@...el.com,
pabeni@...hat.com, tom@...ntonium.net, Jason@...c4.com,
fw@...len.de, netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
alexander.levin@....verizon.com, devtimhansen@...il.com
Subject: Re: [PATCH] net/core: Fix BUG to BUG_ON conditionals.
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@...emloft.net>
:::::: CC: David S. Miller <davem@...emloft.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (46057 bytes)
Powered by blists - more mailing lists