public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/video/fbdev/core/fbmem.c:1165:21: error: 'blank' undeclared; did you mean 'fb_blank'?
@ 2022-02-01 10:42 kernel test robot
  2022-02-01 10:56 ` [PATCH v3] fbdev: fbmem: Fix the implicit type casting Yizhuo Zhai
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-02-01 10:42 UTC (permalink / raw)
  To: Yizhuo Zhai; +Cc: kbuild-all, linux-kernel, 0day robot

tree:   https://github.com/0day-ci/linux/commits/UPDATE-20220201-103710/Yizhuo-Zhai/fbdev-fbmem-Fix-the-implicit-type-casting/20220131-150528
head:   385d42ed58600c12390f350f56849260a19138a9
commit: 385d42ed58600c12390f350f56849260a19138a9 fbdev: fbmem: Fix the implicit type casting
date:   8 hours ago
config: riscv-randconfig-r042-20220130 (https://download.01.org/0day-ci/archive/20220201/202202011802.cpmdbzHR-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 11.2.0
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://github.com/0day-ci/linux/commit/385d42ed58600c12390f350f56849260a19138a9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review UPDATE-20220201-103710/Yizhuo-Zhai/fbdev-fbmem-Fix-the-implicit-type-casting/20220131-150528
        git checkout 385d42ed58600c12390f350f56849260a19138a9
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=riscv SHELL=/bin/bash drivers/video/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/video/fbdev/core/fbmem.c: In function 'do_fb_ioctl':
>> drivers/video/fbdev/core/fbmem.c:1165:21: error: 'blank' undeclared (first use in this function); did you mean 'fb_blank'?
    1165 |                 if (blank > FB_BLANK_POWERDOWN)
         |                     ^~~~~
         |                     fb_blank
   drivers/video/fbdev/core/fbmem.c:1165:21: note: each undeclared identifier is reported only once for each function it appears in


vim +1165 drivers/video/fbdev/core/fbmem.c

  1087	
  1088	static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
  1089				unsigned long arg)
  1090	{
  1091		const struct fb_ops *fb;
  1092		struct fb_var_screeninfo var;
  1093		struct fb_fix_screeninfo fix;
  1094		struct fb_cmap cmap_from;
  1095		struct fb_cmap_user cmap;
  1096		void __user *argp = (void __user *)arg;
  1097		long ret = 0;
  1098	
  1099		switch (cmd) {
  1100		case FBIOGET_VSCREENINFO:
  1101			lock_fb_info(info);
  1102			var = info->var;
  1103			unlock_fb_info(info);
  1104	
  1105			ret = copy_to_user(argp, &var, sizeof(var)) ? -EFAULT : 0;
  1106			break;
  1107		case FBIOPUT_VSCREENINFO:
  1108			if (copy_from_user(&var, argp, sizeof(var)))
  1109				return -EFAULT;
  1110			console_lock();
  1111			lock_fb_info(info);
  1112			ret = fb_set_var(info, &var);
  1113			if (!ret)
  1114				fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL);
  1115			unlock_fb_info(info);
  1116			console_unlock();
  1117			if (!ret && copy_to_user(argp, &var, sizeof(var)))
  1118				ret = -EFAULT;
  1119			break;
  1120		case FBIOGET_FSCREENINFO:
  1121			lock_fb_info(info);
  1122			memcpy(&fix, &info->fix, sizeof(fix));
  1123			if (info->flags & FBINFO_HIDE_SMEM_START)
  1124				fix.smem_start = 0;
  1125			unlock_fb_info(info);
  1126	
  1127			ret = copy_to_user(argp, &fix, sizeof(fix)) ? -EFAULT : 0;
  1128			break;
  1129		case FBIOPUTCMAP:
  1130			if (copy_from_user(&cmap, argp, sizeof(cmap)))
  1131				return -EFAULT;
  1132			ret = fb_set_user_cmap(&cmap, info);
  1133			break;
  1134		case FBIOGETCMAP:
  1135			if (copy_from_user(&cmap, argp, sizeof(cmap)))
  1136				return -EFAULT;
  1137			lock_fb_info(info);
  1138			cmap_from = info->cmap;
  1139			unlock_fb_info(info);
  1140			ret = fb_cmap_to_user(&cmap_from, &cmap);
  1141			break;
  1142		case FBIOPAN_DISPLAY:
  1143			if (copy_from_user(&var, argp, sizeof(var)))
  1144				return -EFAULT;
  1145			console_lock();
  1146			lock_fb_info(info);
  1147			ret = fb_pan_display(info, &var);
  1148			unlock_fb_info(info);
  1149			console_unlock();
  1150			if (ret == 0 && copy_to_user(argp, &var, sizeof(var)))
  1151				return -EFAULT;
  1152			break;
  1153		case FBIO_CURSOR:
  1154			ret = -EINVAL;
  1155			break;
  1156		case FBIOGET_CON2FBMAP:
  1157			ret = fbcon_get_con2fb_map_ioctl(argp);
  1158			break;
  1159		case FBIOPUT_CON2FBMAP:
  1160			ret = fbcon_set_con2fb_map_ioctl(argp);
  1161			break;
  1162		case FBIOBLANK:
  1163			console_lock();
  1164			lock_fb_info(info);
> 1165			if (blank > FB_BLANK_POWERDOWN)
  1166				blank = FB_BLANK_POWERDOWN;
  1167			ret = fb_blank(info, arg);
  1168			/* might again call into fb_blank */
  1169			fbcon_fb_blanked(info, arg);
  1170			unlock_fb_info(info);
  1171			console_unlock();
  1172			break;
  1173		default:
  1174			lock_fb_info(info);
  1175			fb = info->fbops;
  1176			if (fb->fb_ioctl)
  1177				ret = fb->fb_ioctl(info, cmd, arg);
  1178			else
  1179				ret = -ENOTTY;
  1180			unlock_fb_info(info);
  1181		}
  1182		return ret;
  1183	}
  1184	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v3] fbdev: fbmem: Fix the implicit type casting
  2022-02-01 10:42 drivers/video/fbdev/core/fbmem.c:1165:21: error: 'blank' undeclared; did you mean 'fb_blank'? kernel test robot
@ 2022-02-01 10:56 ` Yizhuo Zhai
  2022-02-01 10:56   ` Yizhuo Zhai
  0 siblings, 1 reply; 3+ messages in thread
From: Yizhuo Zhai @ 2022-02-01 10:56 UTC (permalink / raw)
  Cc: Yizhuo Zhai, Helge Deller, Daniel Vetter, Matthew Wilcox,
	Sam Ravnborg, Geert Uytterhoeven, Zhen Lei, Guenter Roeck,
	Zheyu Ma, Xiyu Yang, Alex Deucher, Tetsuo Handa, linux-fbdev,
	dri-devel, linux-kernel

In function do_fb_ioctl(), the "arg" is the type of unsigned long,
and in "case FBIOBLANK:" this argument is casted into an int before
passig to fb_blank(). In fb_blank(), the comparision
if (blank > FB_BLANK_POWERDOWN) would be bypass if the original
"arg" is a large number, which is possible because it comes from
the user input. Fix this by adding the check before the function
call.

Signed-off-by: Yizhuo Zhai <yzhai003@ucr.edu>
---
 drivers/video/fbdev/core/fbmem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 0fa7ede94fa6..991711bfd647 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1162,6 +1162,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 	case FBIOBLANK:
 		console_lock();
 		lock_fb_info(info);
+		if (arg > FB_BLANK_POWERDOWN)
+			arg = FB_BLANK_POWERDOWN;
 		ret = fb_blank(info, arg);
 		/* might again call into fb_blank */
 		fbcon_fb_blanked(info, arg);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v3] fbdev: fbmem: Fix the implicit type casting
  2022-02-01 10:56 ` [PATCH v3] fbdev: fbmem: Fix the implicit type casting Yizhuo Zhai
@ 2022-02-01 10:56   ` Yizhuo Zhai
  0 siblings, 0 replies; 3+ messages in thread
From: Yizhuo Zhai @ 2022-02-01 10:56 UTC (permalink / raw)
  Cc: Yizhuo Zhai, Helge Deller, Daniel Vetter, Matthew Wilcox,
	Sam Ravnborg, Xin Tan, Geert Uytterhoeven, Tetsuo Handa, Zheyu Ma,
	Guenter Roeck, Alex Deucher, Zhen Lei, Xiyu Yang, linux-fbdev,
	dri-devel, linux-kernel

In function do_fb_ioctl(), the "arg" is the type of unsigned long,
and in "case FBIOBLANK:" this argument is casted into an int before
passig to fb_blank(). In fb_blank(), the comparision
if (blank > FB_BLANK_POWERDOWN) would be bypass if the original
"arg" is a large number, which is possible because it comes from
the user input. Fix this by adding the check before the function
call.

Signed-off-by: Yizhuo Zhai <yzhai003@ucr.edu>
---
 drivers/video/fbdev/core/fbmem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 0fa7ede94fa6..991711bfd647 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1162,6 +1162,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 	case FBIOBLANK:
 		console_lock();
 		lock_fb_info(info);
+		if (arg > FB_BLANK_POWERDOWN)
+			arg = FB_BLANK_POWERDOWN;
 		ret = fb_blank(info, arg);
 		/* might again call into fb_blank */
 		fbcon_fb_blanked(info, arg);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-01 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-01 10:42 drivers/video/fbdev/core/fbmem.c:1165:21: error: 'blank' undeclared; did you mean 'fb_blank'? kernel test robot
2022-02-01 10:56 ` [PATCH v3] fbdev: fbmem: Fix the implicit type casting Yizhuo Zhai
2022-02-01 10:56   ` Yizhuo Zhai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox