Commit 33a9006
bpf: stub out skb metadata dynptr read/write ops when CONFIG_NET=n
Kernel Test Robot reported a compiler warning - a null pointer may be
passed to memmove in __bpf_dynptr_{read,write} when building without
networking support.
The warning is correct from a static analysis standpoint, but not actually
reachable. Without CONFIG_NET, creating dynptrs to skb metadata is
impossible since the constructor kfunc is missing.
Fix this the same way as for skb and xdp data dynptrs. Add wrappers for
loading and storing bytes to skb metadata, and stub them out to return an
error when CONFIG_NET=n.
Fixes: 6877cd3 ("bpf: Enable read/write access to skb metadata through a dynptr")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Jakub Sitnicki <[email protected]>1 parent 8f9c214 commit 33a9006
2 files changed
+28
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1779 | 1779 | | |
1780 | 1780 | | |
1781 | 1781 | | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
1782 | 1796 | | |
1783 | 1797 | | |
1784 | 1798 | | |
| |||
1818 | 1832 | | |
1819 | 1833 | | |
1820 | 1834 | | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
1821 | 1847 | | |
1822 | 1848 | | |
1823 | 1849 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1778 | 1778 | | |
1779 | 1779 | | |
1780 | 1780 | | |
1781 | | - | |
1782 | | - | |
| 1781 | + | |
1783 | 1782 | | |
1784 | 1783 | | |
1785 | 1784 | | |
| |||
1839 | 1838 | | |
1840 | 1839 | | |
1841 | 1840 | | |
1842 | | - | |
1843 | | - | |
| 1841 | + | |
1844 | 1842 | | |
1845 | 1843 | | |
1846 | 1844 | | |
| |||
0 commit comments