Re: [PATCH v4 1/2] mm: huge_memory: a new debugfs interface for splitting THP tests.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15 Mar 2021, at 20:36, kernel test robot wrote:

> Hi Zi,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on kselftest/next]
> [also build test WARNING on linux/master linus/master v5.12-rc3]
> [cannot apply to hnaz-linux-mm/master next-20210315]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/0day-ci/linux/commits/Zi-Yan/mm-huge_memory-a-new-debugfs-interface-for-splitting-THP-tests/20210316-043528
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
> config: i386-randconfig-m021-20210315 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> smatch warnings:
> mm/huge_memory.c:3086 split_huge_pages_write() warn: sscanf doesn't return error codes
>
> vim +3086 mm/huge_memory.c
>
>   3051	
>   3052	static ssize_t split_huge_pages_write(struct file *file, const char __user *buf,
>   3053					size_t count, loff_t *ppops)
>   3054	{
>   3055		static DEFINE_MUTEX(mutex);
>   3056		ssize_t ret;
>   3057		char input_buf[80]; /* hold pid, start_vaddr, end_vaddr */
>   3058		int pid;
>   3059		unsigned long vaddr_start, vaddr_end;
>   3060	
>   3061		ret = mutex_lock_interruptible(&mutex);
>   3062		if (ret)
>   3063			return ret;
>   3064	
>   3065		ret = -EFAULT;
>   3066	
>   3067		memset(input_buf, 0, 80);
>   3068		if (copy_from_user(input_buf, buf, min_t(size_t, count, 80)))
>   3069			goto out;
>   3070	
>   3071		input_buf[79] = '\0';
>   3072		ret = sscanf(input_buf, "%d,0x%lx,0x%lx", &pid, &vaddr_start, &vaddr_end);
>   3073		if (ret == 1 && pid == 1) {
>   3074			split_huge_pages_all();
>   3075			ret = strlen(input_buf);
>   3076			goto out;
>   3077		} else if (ret != 3) {
>   3078			ret = -EINVAL;
>   3079			goto out;
>   3080		}
>   3081	
>   3082		if (!split_huge_pages_pid(pid, vaddr_start, vaddr_end))
>   3083			ret = strlen(input_buf);

Change this to:

ret = split_huge_pages_pid(pid, vaddr_start, vaddr_end);
if (!ret)
	ret = strlen(input_buf);

should fix the warning. I will resend after I get feedback for the patches.


>   3084	out:
>   3085		mutex_unlock(&mutex);
>> 3086		return ret;
>   3087	





—
Best Regards,
Yan Zi

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux