Content-Type: multipart/mixed; boundary="===============7293271269677422912==" MIME-Version: 1.0 From: kbuild test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH 2/2] thp, shmem: Fix conflict of above-47bit hint address and PMD alignment Date: Sat, 28 Dec 2019 08:10:07 +0800 Message-ID: <201912280704.DFqECoHe%lkp@intel.com> In-Reply-To: <20191220142548.7118-3-kirill.shutemov@linux.intel.com> List-Id: --===============7293271269677422912== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi "Kirill, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v5.5-rc3 next-20191220] [if your patch is applied to the wrong git tree, please drop us a note to h= elp improve the system. BTW, we also suggest to use '--base' option to specify = the base tree in git format-patch, please see https://stackoverflow.com/a/37406= 982] url: https://github.com/0day-ci/linux/commits/Kirill-A-Shutemov/Fix-two-= above-47bit-hint-address-vs-THP-bugs/20191223-221713 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = 46cf053efec6a3a5f343fead837777efe8252a46 reproduce: # apt-get install sparse # sparse version: v0.6.1-129-g341daf20-dirty make ARCH=3Dx86_64 allmodconfig make C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) >> mm/shmem.c:2147:34: sparse: sparse: incorrect type in argument 1 (differ= ent base types) >> mm/shmem.c:2147:34: sparse: expected struct file * >> mm/shmem.c:2147:34: sparse: got unsigned long uaddr vim +2147 mm/shmem.c 2073 = 2074 unsigned long shmem_get_unmapped_area(struct file *file, 2075 unsigned long uaddr, unsigned long len, 2076 unsigned long pgoff, unsigned long flags) 2077 { 2078 unsigned long (*get_area)(struct file *, 2079 unsigned long, unsigned long, unsigned long, unsigned long); 2080 unsigned long addr; 2081 unsigned long offset; 2082 unsigned long inflated_len; 2083 unsigned long inflated_addr; 2084 unsigned long inflated_offset; 2085 = 2086 if (len > TASK_SIZE) 2087 return -ENOMEM; 2088 = 2089 get_area =3D current->mm->get_unmapped_area; 2090 addr =3D get_area(file, uaddr, len, pgoff, flags); 2091 = 2092 if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGE_PAGECACHE)) 2093 return addr; 2094 if (IS_ERR_VALUE(addr)) 2095 return addr; 2096 if (addr & ~PAGE_MASK) 2097 return addr; 2098 if (addr > TASK_SIZE - len) 2099 return addr; 2100 = 2101 if (shmem_huge =3D=3D SHMEM_HUGE_DENY) 2102 return addr; 2103 if (len < HPAGE_PMD_SIZE) 2104 return addr; 2105 if (flags & MAP_FIXED) 2106 return addr; 2107 /* 2108 * Our priority is to support MAP_SHARED mapped hugely; 2109 * and support MAP_PRIVATE mapped hugely too, until it is COWed. 2110 * But if caller specified an address hint and we allocated area th= ere 2111 * successfully, respect that as before. 2112 */ 2113 if (uaddr =3D=3D addr) 2114 return addr; 2115 = 2116 if (shmem_huge !=3D SHMEM_HUGE_FORCE) { 2117 struct super_block *sb; 2118 = 2119 if (file) { 2120 VM_BUG_ON(file->f_op !=3D &shmem_file_operations); 2121 sb =3D file_inode(file)->i_sb; 2122 } else { 2123 /* 2124 * Called directly from mm/mmap.c, or drivers/char/mem.c 2125 * for "/dev/zero", to create a shared anonymous object. 2126 */ 2127 if (IS_ERR(shm_mnt)) 2128 return addr; 2129 sb =3D shm_mnt->mnt_sb; 2130 } 2131 if (SHMEM_SB(sb)->huge =3D=3D SHMEM_HUGE_NEVER) 2132 return addr; 2133 } 2134 = 2135 offset =3D (pgoff << PAGE_SHIFT) & (HPAGE_PMD_SIZE-1); 2136 if (offset && offset + len < 2 * HPAGE_PMD_SIZE) 2137 return addr; 2138 if ((addr & (HPAGE_PMD_SIZE-1)) =3D=3D offset) 2139 return addr; 2140 = 2141 inflated_len =3D len + HPAGE_PMD_SIZE - PAGE_SIZE; 2142 if (inflated_len > TASK_SIZE) 2143 return addr; 2144 if (inflated_len < len) 2145 return addr; 2146 = > 2147 inflated_addr =3D get_area(uaddr, 0, inflated_len, 0, flags); 2148 if (IS_ERR_VALUE(inflated_addr)) 2149 return addr; 2150 if (inflated_addr & ~PAGE_MASK) 2151 return addr; 2152 = 2153 inflated_offset =3D inflated_addr & (HPAGE_PMD_SIZE-1); 2154 inflated_addr +=3D offset - inflated_offset; 2155 if (inflated_offset > offset) 2156 inflated_addr +=3D HPAGE_PMD_SIZE; 2157 = 2158 if (inflated_addr > TASK_SIZE - len) 2159 return addr; 2160 return inflated_addr; 2161 } 2162 = --- 0-DAY kernel test infrastructure Open Source Technology Cen= ter https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corpor= ation --===============7293271269677422912==--