Re: [PATCH 28/30] fbdev/core: Move file-I/O code into separate file

kernel test robot <[email protected]>
Newsgroups gmane.linux.ports.sh.devel,gmane.comp.video.dri.devel,gmane.linux.ports.arm.omap
Message-ID <[email protected]>
Hi Thomas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20230605]
[cannot apply to drm-misc/drm-misc-next lee-backlight/for-backlight-next staging/staging-testing staging/staging-next staging/staging-linus linus/master lee-backlight/for-backlight-fixes v6.4-rc5 v6.4-rc4 v6.4-rc3 v6.4-rc5]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/backlight-bd6107-Compare-against-struct-fb_info-device/20230605-225002
base:   next-20230605
patch link:    https://lore.kernel.org/r/20230605144812.15241-29-tzimmermann%40suse.de
patch subject: [PATCH 28/30] fbdev/core: Move file-I/O code into separate file
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230606/[email protected]/config)
compiler: sparc64-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
        mkdir -p ~/bin
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/34fb1357f6464f1173e12cd241310efa5577dd79
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Thomas-Zimmermann/backlight-bd6107-Compare-against-struct-fb_info-device/20230605-225002
        git checkout 34fb1357f6464f1173e12cd241310efa5577dd79
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=sparc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/video/fbdev/core/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   drivers/video/fbdev/core/fb_devfs.c:174:9: error: unknown type name 'compat_caddr_t'
     174 |         compat_caddr_t          smem_start;
         |         ^~~~~~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c:183:9: error: unknown type name 'compat_caddr_t'
     183 |         compat_caddr_t          mmio_start;
         |         ^~~~~~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c:192:9: error: unknown type name 'compat_caddr_t'
     192 |         compat_caddr_t  red;
         |         ^~~~~~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c:193:9: error: unknown type name 'compat_caddr_t'
     193 |         compat_caddr_t  green;
         |         ^~~~~~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c:194:9: error: unknown type name 'compat_caddr_t'
     194 |         compat_caddr_t  blue;
         |         ^~~~~~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c:195:9: error: unknown type name 'compat_caddr_t'
     195 |         compat_caddr_t  transp;
         |         ^~~~~~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c: In function 'fb_getput_cmap':
   drivers/video/fbdev/core/fb_devfs.c:205:37: error: implicit declaration of function 'compat_ptr' [-Werror=implicit-function-declaration]
     205 |         if (copy_from_user(&cmap32, compat_ptr(arg), sizeof(cmap32)))
         |                                     ^~~~~~~~~~
>> drivers/video/fbdev/core/fb_devfs.c:205:37: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast [-Wint-conversion]
     205 |         if (copy_from_user(&cmap32, compat_ptr(arg), sizeof(cmap32)))
         |                                     ^~~~~~~~~~~~~~~
         |                                     |
         |                                     int
   In file included from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/huge_mm.h:8,
                    from include/linux/mm.h:989,
                    from include/linux/kallsyms.h:13,
                    from include/linux/ftrace.h:13,
                    from include/linux/kprobes.h:28,
                    from include/linux/kgdb.h:19,
                    from include/linux/fb.h:6,
                    from drivers/video/fbdev/core/fb_devfs.c:4:
   include/linux/uaccess.h:180:45: note: expected 'const void *' but argument is of type 'int'
     180 | copy_from_user(void *to, const void __user *from, unsigned long n)
         |                          ~~~~~~~~~~~~~~~~~~~^~~~
>> drivers/video/fbdev/core/fb_devfs.c:211:27: warning: initialization of '__u16 *' {aka 'short unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
     211 |                 .red    = compat_ptr(cmap32.red),
         |                           ^~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c:211:27: note: (near initialization for '(anonymous).red')
   drivers/video/fbdev/core/fb_devfs.c:212:27: warning: initialization of '__u16 *' {aka 'short unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
     212 |                 .green  = compat_ptr(cmap32.green),
         |                           ^~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c:212:27: note: (near initialization for '(anonymous).green')
   drivers/video/fbdev/core/fb_devfs.c:213:27: warning: initialization of '__u16 *' {aka 'short unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
     213 |                 .blue   = compat_ptr(cmap32.blue),
         |                           ^~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c:213:27: note: (near initialization for '(anonymous).blue')
   drivers/video/fbdev/core/fb_devfs.c:214:27: warning: initialization of '__u16 *' {aka 'short unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
     214 |                 .transp = compat_ptr(cmap32.transp),
         |                           ^~~~~~~~~~
   drivers/video/fbdev/core/fb_devfs.c:214:27: note: (near initialization for '(anonymous).transp')
   drivers/video/fbdev/core/fb_devfs.c: In function 'fb_get_fscreeninfo':
>> drivers/video/fbdev/core/fb_devfs.c:270:45: warning: passing argument 2 of 'do_fscreeninfo_to_user' makes pointer from integer without a cast [-Wint-conversion]
     270 |         return do_fscreeninfo_to_user(&fix, compat_ptr(arg));
         |                                             ^~~~~~~~~~~~~~~
         |                                             |
         |                                             int
   drivers/video/fbdev/core/fb_devfs.c:228:70: note: expected 'struct fb_fix_screeninfo32 *' but argument is of type 'int'
     228 |                                   struct fb_fix_screeninfo32 __user *fix32)
         |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
   cc1: some warnings being treated as errors


vim +/copy_from_user +205 drivers/video/fbdev/core/fb_devfs.c

   197	
   198	static int fb_getput_cmap(struct fb_info *info, unsigned int cmd,
   199				  unsigned long arg)
   200	{
   201		struct fb_cmap32 cmap32;
   202		struct fb_cmap cmap_from;
   203		struct fb_cmap_user cmap;
   204	
 > 205		if (copy_from_user(&cmap32, compat_ptr(arg), sizeof(cmap32)))
   206			return -EFAULT;
   207	
   208		cmap = (struct fb_cmap_user) {
   209			.start	= cmap32.start,
   210			.len	= cmap32.len,
 > 211			.red	= compat_ptr(cmap32.red),
   212			.green	= compat_ptr(cmap32.green),
   213			.blue	= compat_ptr(cmap32.blue),
   214			.transp	= compat_ptr(cmap32.transp),
   215		};
   216	
   217		if (cmd == FBIOPUTCMAP)
   218			return fb_set_user_cmap(&cmap, info);
   219	
   220		lock_fb_info(info);
   221		cmap_from = info->cmap;
   222		unlock_fb_info(info);
   223	
   224		return fb_cmap_to_user(&cmap_from, &cmap);
   225	}
   226	
   227	static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix,
   228					  struct fb_fix_screeninfo32 __user *fix32)
   229	{
   230		__u32 data;
   231		int err;
   232	
   233		err = copy_to_user(&fix32->id, &fix->id, sizeof(fix32->id));
   234	
   235		data = (__u32) (unsigned long) fix->smem_start;
   236		err |= put_user(data, &fix32->smem_start);
   237	
   238		err |= put_user(fix->smem_len, &fix32->smem_len);
   239		err |= put_user(fix->type, &fix32->type);
   240		err |= put_user(fix->type_aux, &fix32->type_aux);
   241		err |= put_user(fix->visual, &fix32->visual);
   242		err |= put_user(fix->xpanstep, &fix32->xpanstep);
   243		err |= put_user(fix->ypanstep, &fix32->ypanstep);
   244		err |= put_user(fix->ywrapstep, &fix32->ywrapstep);
   245		err |= put_user(fix->line_length, &fix32->line_length);
   246	
   247		data = (__u32) (unsigned long) fix->mmio_start;
   248		err |= put_user(data, &fix32->mmio_start);
   249	
   250		err |= put_user(fix->mmio_len, &fix32->mmio_len);
   251		err |= put_user(fix->accel, &fix32->accel);
   252		err |= copy_to_user(fix32->reserved, fix->reserved,
   253				    sizeof(fix->reserved));
   254	
   255		if (err)
   256			return -EFAULT;
   257		return 0;
   258	}
   259	
   260	static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,
   261				      unsigned long arg)
   262	{
   263		struct fb_fix_screeninfo fix;
   264	
   265		lock_fb_info(info);
   266		fix = info->fix;
   267		if (info->flags & FBINFO_HIDE_SMEM_START)
   268			fix.smem_start = 0;
   269		unlock_fb_info(info);
 > 270		return do_fscreeninfo_to_user(&fix, compat_ptr(arg));
   271	}
   272	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.