drivers/gpio/gpiolib-cdev.c:1437:1: warning: the frame size of 1040 bytes is larger than 1024 bytes
From: kernel test robot
Date: Sat Dec 26 2020 - 21:59:45 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f838f8d2b694cf9d524dc4423e9dd2db13892f3f
commit: aad955842d1cdf56d31e600112137d82fd431140 gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL
date: 3 months ago
config: arm-randconfig-r036-20201224 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aad955842d1cdf56d31e600112137d82fd431140
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout aad955842d1cdf56d31e600112137d82fd431140
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
drivers/gpio/gpiolib-cdev.c: In function 'gpio_ioctl':
>> drivers/gpio/gpiolib-cdev.c:1437:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
1437 | }
| ^
vim +1437 drivers/gpio/gpiolib-cdev.c
aad955842d1cdf5 Kent Gibson 2020-09-28 1335
925ca36913fc7df Kent Gibson 2020-06-16 1336 /*
925ca36913fc7df Kent Gibson 2020-06-16 1337 * gpio_ioctl() - ioctl handler for the GPIO chardev
925ca36913fc7df Kent Gibson 2020-06-16 1338 */
49bc52798d7bb66 Kent Gibson 2020-07-08 1339 static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
925ca36913fc7df Kent Gibson 2020-06-16 1340 {
e2b781c5f0dd45f Kent Gibson 2020-07-08 1341 struct gpio_chardev_data *cdev = file->private_data;
e2b781c5f0dd45f Kent Gibson 2020-07-08 1342 struct gpio_device *gdev = cdev->gdev;
925ca36913fc7df Kent Gibson 2020-06-16 1343 struct gpio_chip *gc = gdev->chip;
925ca36913fc7df Kent Gibson 2020-06-16 1344 void __user *ip = (void __user *)arg;
925ca36913fc7df Kent Gibson 2020-06-16 1345 __u32 offset;
925ca36913fc7df Kent Gibson 2020-06-16 1346
925ca36913fc7df Kent Gibson 2020-06-16 1347 /* We fail any subsequent ioctl():s when the chip is gone */
925ca36913fc7df Kent Gibson 2020-06-16 1348 if (!gc)
925ca36913fc7df Kent Gibson 2020-06-16 1349 return -ENODEV;
925ca36913fc7df Kent Gibson 2020-06-16 1350
925ca36913fc7df Kent Gibson 2020-06-16 1351 /* Fill in the struct and pass to userspace */
925ca36913fc7df Kent Gibson 2020-06-16 1352 if (cmd == GPIO_GET_CHIPINFO_IOCTL) {
925ca36913fc7df Kent Gibson 2020-06-16 1353 struct gpiochip_info chipinfo;
925ca36913fc7df Kent Gibson 2020-06-16 1354
925ca36913fc7df Kent Gibson 2020-06-16 1355 memset(&chipinfo, 0, sizeof(chipinfo));
925ca36913fc7df Kent Gibson 2020-06-16 1356
69e4e1368803266 Kent Gibson 2020-09-28 1357 strscpy(chipinfo.name, dev_name(&gdev->dev),
925ca36913fc7df Kent Gibson 2020-06-16 1358 sizeof(chipinfo.name));
69e4e1368803266 Kent Gibson 2020-09-28 1359 strscpy(chipinfo.label, gdev->label,
925ca36913fc7df Kent Gibson 2020-06-16 1360 sizeof(chipinfo.label));
925ca36913fc7df Kent Gibson 2020-06-16 1361 chipinfo.lines = gdev->ngpio;
925ca36913fc7df Kent Gibson 2020-06-16 1362 if (copy_to_user(ip, &chipinfo, sizeof(chipinfo)))
925ca36913fc7df Kent Gibson 2020-06-16 1363 return -EFAULT;
925ca36913fc7df Kent Gibson 2020-06-16 1364 return 0;
3c0d9c635ae2b2c Kent Gibson 2020-09-28 1365 #ifdef CONFIG_GPIO_CDEV_V1
925ca36913fc7df Kent Gibson 2020-06-16 1366 } else if (cmd == GPIO_GET_LINEINFO_IOCTL) {
aad955842d1cdf5 Kent Gibson 2020-09-28 1367 struct gpio_desc *desc;
925ca36913fc7df Kent Gibson 2020-06-16 1368 struct gpioline_info lineinfo;
aad955842d1cdf5 Kent Gibson 2020-09-28 1369 struct gpio_v2_line_info lineinfo_v2;
925ca36913fc7df Kent Gibson 2020-06-16 1370
925ca36913fc7df Kent Gibson 2020-06-16 1371 if (copy_from_user(&lineinfo, ip, sizeof(lineinfo)))
925ca36913fc7df Kent Gibson 2020-06-16 1372 return -EFAULT;
925ca36913fc7df Kent Gibson 2020-06-16 1373
1bf7ba400173c3a Kent Gibson 2020-07-08 1374 /* this doubles as a range check on line_offset */
925ca36913fc7df Kent Gibson 2020-06-16 1375 desc = gpiochip_get_desc(gc, lineinfo.line_offset);
925ca36913fc7df Kent Gibson 2020-06-16 1376 if (IS_ERR(desc))
925ca36913fc7df Kent Gibson 2020-06-16 1377 return PTR_ERR(desc);
925ca36913fc7df Kent Gibson 2020-06-16 1378
aad955842d1cdf5 Kent Gibson 2020-09-28 1379 gpio_desc_to_lineinfo(desc, &lineinfo_v2);
aad955842d1cdf5 Kent Gibson 2020-09-28 1380 gpio_v2_line_info_to_v1(&lineinfo_v2, &lineinfo);
925ca36913fc7df Kent Gibson 2020-06-16 1381
925ca36913fc7df Kent Gibson 2020-06-16 1382 if (copy_to_user(ip, &lineinfo, sizeof(lineinfo)))
925ca36913fc7df Kent Gibson 2020-06-16 1383 return -EFAULT;
925ca36913fc7df Kent Gibson 2020-06-16 1384 return 0;
925ca36913fc7df Kent Gibson 2020-06-16 1385 } else if (cmd == GPIO_GET_LINEHANDLE_IOCTL) {
925ca36913fc7df Kent Gibson 2020-06-16 1386 return linehandle_create(gdev, ip);
925ca36913fc7df Kent Gibson 2020-06-16 1387 } else if (cmd == GPIO_GET_LINEEVENT_IOCTL) {
925ca36913fc7df Kent Gibson 2020-06-16 1388 return lineevent_create(gdev, ip);
925ca36913fc7df Kent Gibson 2020-06-16 1389 } else if (cmd == GPIO_GET_LINEINFO_WATCH_IOCTL) {
aad955842d1cdf5 Kent Gibson 2020-09-28 1390 struct gpio_desc *desc;
925ca36913fc7df Kent Gibson 2020-06-16 1391 struct gpioline_info lineinfo;
aad955842d1cdf5 Kent Gibson 2020-09-28 1392 struct gpio_v2_line_info lineinfo_v2;
925ca36913fc7df Kent Gibson 2020-06-16 1393
925ca36913fc7df Kent Gibson 2020-06-16 1394 if (copy_from_user(&lineinfo, ip, sizeof(lineinfo)))
925ca36913fc7df Kent Gibson 2020-06-16 1395 return -EFAULT;
925ca36913fc7df Kent Gibson 2020-06-16 1396
1bf7ba400173c3a Kent Gibson 2020-07-08 1397 /* this doubles as a range check on line_offset */
925ca36913fc7df Kent Gibson 2020-06-16 1398 desc = gpiochip_get_desc(gc, lineinfo.line_offset);
925ca36913fc7df Kent Gibson 2020-06-16 1399 if (IS_ERR(desc))
925ca36913fc7df Kent Gibson 2020-06-16 1400 return PTR_ERR(desc);
925ca36913fc7df Kent Gibson 2020-06-16 1401
aad955842d1cdf5 Kent Gibson 2020-09-28 1402 if (lineinfo_ensure_abi_version(cdev, 1))
aad955842d1cdf5 Kent Gibson 2020-09-28 1403 return -EPERM;
aad955842d1cdf5 Kent Gibson 2020-09-28 1404
1bf7ba400173c3a Kent Gibson 2020-07-08 1405 if (test_and_set_bit(lineinfo.line_offset, cdev->watched_lines))
925ca36913fc7df Kent Gibson 2020-06-16 1406 return -EBUSY;
925ca36913fc7df Kent Gibson 2020-06-16 1407
aad955842d1cdf5 Kent Gibson 2020-09-28 1408 gpio_desc_to_lineinfo(desc, &lineinfo_v2);
aad955842d1cdf5 Kent Gibson 2020-09-28 1409 gpio_v2_line_info_to_v1(&lineinfo_v2, &lineinfo);
925ca36913fc7df Kent Gibson 2020-06-16 1410
f30ef3e8376380c Kent Gibson 2020-07-08 1411 if (copy_to_user(ip, &lineinfo, sizeof(lineinfo))) {
1bf7ba400173c3a Kent Gibson 2020-07-08 1412 clear_bit(lineinfo.line_offset, cdev->watched_lines);
925ca36913fc7df Kent Gibson 2020-06-16 1413 return -EFAULT;
f30ef3e8376380c Kent Gibson 2020-07-08 1414 }
925ca36913fc7df Kent Gibson 2020-06-16 1415
925ca36913fc7df Kent Gibson 2020-06-16 1416 return 0;
3c0d9c635ae2b2c Kent Gibson 2020-09-28 1417 #endif /* CONFIG_GPIO_CDEV_V1 */
aad955842d1cdf5 Kent Gibson 2020-09-28 1418 } else if (cmd == GPIO_V2_GET_LINEINFO_IOCTL ||
aad955842d1cdf5 Kent Gibson 2020-09-28 1419 cmd == GPIO_V2_GET_LINEINFO_WATCH_IOCTL) {
aad955842d1cdf5 Kent Gibson 2020-09-28 1420 return lineinfo_get(cdev, ip,
aad955842d1cdf5 Kent Gibson 2020-09-28 1421 cmd == GPIO_V2_GET_LINEINFO_WATCH_IOCTL);
3c0d9c635ae2b2c Kent Gibson 2020-09-28 1422 } else if (cmd == GPIO_V2_GET_LINE_IOCTL) {
3c0d9c635ae2b2c Kent Gibson 2020-09-28 1423 return linereq_create(gdev, ip);
925ca36913fc7df Kent Gibson 2020-06-16 1424 } else if (cmd == GPIO_GET_LINEINFO_UNWATCH_IOCTL) {
925ca36913fc7df Kent Gibson 2020-06-16 1425 if (copy_from_user(&offset, ip, sizeof(offset)))
925ca36913fc7df Kent Gibson 2020-06-16 1426 return -EFAULT;
925ca36913fc7df Kent Gibson 2020-06-16 1427
1bf7ba400173c3a Kent Gibson 2020-07-08 1428 if (offset >= cdev->gdev->ngpio)
1bf7ba400173c3a Kent Gibson 2020-07-08 1429 return -EINVAL;
925ca36913fc7df Kent Gibson 2020-06-16 1430
1bf7ba400173c3a Kent Gibson 2020-07-08 1431 if (!test_and_clear_bit(offset, cdev->watched_lines))
925ca36913fc7df Kent Gibson 2020-06-16 1432 return -EBUSY;
925ca36913fc7df Kent Gibson 2020-06-16 1433
925ca36913fc7df Kent Gibson 2020-06-16 1434 return 0;
925ca36913fc7df Kent Gibson 2020-06-16 1435 }
925ca36913fc7df Kent Gibson 2020-06-16 1436 return -EINVAL;
925ca36913fc7df Kent Gibson 2020-06-16 @1437 }
925ca36913fc7df Kent Gibson 2020-06-16 1438
:::::: The code at line 1437 was first introduced by commit
:::::: 925ca36913fc7dfee9d0bb7f36d81dd108a7b80f gpiolib: split character device into gpiolib-cdev
:::::: TO: Kent Gibson <warthog618@xxxxxxxxx>
:::::: CC: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip