Subject: Re: [next-20170609][bisected 4d72ba0] WARNING: CPU: 8 PID: 11043 at lib/vsprintf.c:1945 set_precision

From: Joe Perches <[email-masked]>
Date: Mon, 12 Jun 2017 01:12:52 -0700

On Mon, 2017-06-12 at 13:23 +0530, Abdul Haleem wrote:
> Hi Rasmus,
> 
> With commit (4d72ba0-lib/vsprintf.c: warn about too large precisions..)
> 
> WARN_ONCE is being triggered while running trinity 
> $ git clone https://github.com/kernelslacker/trinity.git
> $ cd trinity;./configure;make 
> $ ./trinity --dangerous
> 
> Machine : Power 8 PowerVM LPAR
> gcc : version 5.2.1
> config : attached
> 
> 
> In file lib/vsprintf.c at line 1945:
> set_precision(struct printf_spec *spec, int prec)
> {
>     spec->precision = prec;
>     if (WARN_ONCE(spec->precision != prec, "precision %d too large",
> prec)) {
>         spec->precision = clamp(prec, 0, PRECISION_MAX);
>     }
> }

Presumably there should be a PATH_MAX maximum check added
to the strlen(name) in get_fs_type.

fs/filesystems.c:271

struct file_system_type *get_fs_type(const char *name)
{
	struct file_system_type *fs;
	const char *dot = strchr(name, '.');
	int len = dot ? dot - name : strlen(name);

	fs = __get_fs_type(name, len);
	if (!fs && (request_module("fs-%.*s", len, name) == 0))
		fs = __get_fs_type(name, len);