tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: f8f60f322f0640c8edda2942ca5f84b7a27c417a commit: 03e6c729aa640eed324de05dc588c05cc00d88d2 [6603/7443] zram: introduce recompress sysfs knob config: hexagon-randconfig-r001-20221111 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 463da45892e2d2a262277b91b96f5f8c05dc25d0) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=03e6c729aa640eed324de05dc588c05cc00d88d2 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 03e6c729aa640eed324de05dc588c05cc00d88d2 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/block/zram/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All warnings (new ones prefixed by >>): In file included from drivers/block/zram/zram_drv.c:20: In file included from include/linux/bio.h:10: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from drivers/block/zram/zram_drv.c:20: In file included from include/linux/bio.h:10: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from drivers/block/zram/zram_drv.c:20: In file included from include/linux/bio.h:10: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ >> drivers/block/zram/zram_drv.c:1857:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (zram_test_flag(zram, index, ZRAM_WB) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1867:7: note: uninitialized use occurs here if (err) { ^~~ drivers/block/zram/zram_drv.c:1857:3: note: remove the 'if' if its condition is always false if (zram_test_flag(zram, index, ZRAM_WB) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/block/zram/zram_drv.c:1857:7: warning: variable 'err' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized] if (zram_test_flag(zram, index, ZRAM_WB) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1867:7: note: uninitialized use occurs here if (err) { ^~~ drivers/block/zram/zram_drv.c:1857:7: note: remove the '||' if its condition is always false if (zram_test_flag(zram, index, ZRAM_WB) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/block/zram/zram_drv.c:1857:7: warning: variable 'err' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized] if (zram_test_flag(zram, index, ZRAM_WB) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1867:7: note: uninitialized use occurs here if (err) { ^~~ drivers/block/zram/zram_drv.c:1857:7: note: remove the '||' if its condition is always false if (zram_test_flag(zram, index, ZRAM_WB) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/block/zram/zram_drv.c:1857:7: warning: variable 'err' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized] if (zram_test_flag(zram, index, ZRAM_WB) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1867:7: note: uninitialized use occurs here if (err) { ^~~ drivers/block/zram/zram_drv.c:1857:7: note: remove the '||' if its condition is always false if (zram_test_flag(zram, index, ZRAM_WB) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1853:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (mode & RECOMPRESS_HUGE && ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1867:7: note: uninitialized use occurs here if (err) { ^~~ drivers/block/zram/zram_drv.c:1853:3: note: remove the 'if' if its condition is always false if (mode & RECOMPRESS_HUGE && ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1849:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (mode & RECOMPRESS_IDLE && ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1867:7: note: uninitialized use occurs here if (err) { ^~~ drivers/block/zram/zram_drv.c:1849:3: note: remove the 'if' if its condition is always false if (mode & RECOMPRESS_IDLE && ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1846:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!zram_allocated(zram, index)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1867:7: note: uninitialized use occurs here if (err) { ^~~ drivers/block/zram/zram_drv.c:1846:3: note: remove the 'if' if its condition is always false if (!zram_allocated(zram, index)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/block/zram/zram_drv.c:1842:10: note: initialize the variable 'err' to silence this warning int err; ^ = 0 13 warnings generated. vim +1857 drivers/block/zram/zram_drv.c 1783 1784 static ssize_t recompress_store(struct device *dev, 1785 struct device_attribute *attr, 1786 const char *buf, size_t len) 1787 { 1788 struct zram *zram = dev_to_zram(dev); 1789 u32 mode = 0, threshold = 0, prio = ZRAM_SECONDARY_COMP; 1790 unsigned long nr_pages = zram->disksize >> PAGE_SHIFT; 1791 char *args, *param, *val; 1792 unsigned long index; 1793 struct page *page; 1794 ssize_t ret; 1795 1796 args = skip_spaces(buf); 1797 while (*args) { 1798 args = next_arg(args, ¶m, &val); 1799 1800 if (!*val) 1801 return -EINVAL; 1802 1803 if (!strcmp(param, "type")) { 1804 if (!strcmp(val, "idle")) 1805 mode = RECOMPRESS_IDLE; 1806 if (!strcmp(val, "huge")) 1807 mode = RECOMPRESS_HUGE; 1808 if (!strcmp(val, "huge_idle")) 1809 mode = RECOMPRESS_IDLE | RECOMPRESS_HUGE; 1810 continue; 1811 } 1812 1813 if (!strcmp(param, "threshold")) { 1814 /* 1815 * We will re-compress only idle objects equal or 1816 * greater in size than watermark. 1817 */ 1818 ret = kstrtouint(val, 10, &threshold); 1819 if (ret) 1820 return ret; 1821 continue; 1822 } 1823 } 1824 1825 if (threshold >= PAGE_SIZE) 1826 return -EINVAL; 1827 1828 down_read(&zram->init_lock); 1829 if (!init_done(zram)) { 1830 ret = -EINVAL; 1831 goto release_init_lock; 1832 } 1833 1834 page = alloc_page(GFP_KERNEL); 1835 if (!page) { 1836 ret = -ENOMEM; 1837 goto release_init_lock; 1838 } 1839 1840 ret = len; 1841 for (index = 0; index < nr_pages; index++) { 1842 int err; 1843 1844 zram_slot_lock(zram, index); 1845 1846 if (!zram_allocated(zram, index)) 1847 goto next; 1848 1849 if (mode & RECOMPRESS_IDLE && 1850 !zram_test_flag(zram, index, ZRAM_IDLE)) 1851 goto next; 1852 1853 if (mode & RECOMPRESS_HUGE && 1854 !zram_test_flag(zram, index, ZRAM_HUGE)) 1855 goto next; 1856 > 1857 if (zram_test_flag(zram, index, ZRAM_WB) || 1858 zram_test_flag(zram, index, ZRAM_UNDER_WB) || 1859 zram_test_flag(zram, index, ZRAM_SAME) || 1860 zram_test_flag(zram, index, ZRAM_INCOMPRESSIBLE)) 1861 goto next; 1862 1863 err = zram_recompress(zram, index, page, threshold, 1864 prio, ZRAM_MAX_COMPS); 1865 next: 1866 zram_slot_unlock(zram, index); 1867 if (err) { 1868 ret = err; 1869 break; 1870 } 1871 1872 cond_resched(); 1873 } 1874 1875 __free_page(page); 1876 1877 release_init_lock: 1878 up_read(&zram->init_lock); 1879 return ret; 1880 } 1881 #endif 1882 -- 0-DAY CI Kernel Test Service https://01.org/lkp