[bug report] media: atomisp_gmin_platform: stop abusing efivar API

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

 



Hi Hans,

The patch 38d4f74bc148: "media: atomisp_gmin_platform: stop abusing
efivar API" from Jun 20, 2022, leads to the following Smatch static
checker warning:

	drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c:1437 gmin_get_var_int()
	error: buffer overflow 'val' 64 <= 64

drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
    1427 
    1428 int gmin_get_var_int(struct device *dev, bool is_gmin, const char *var, int def)
    1429 {
    1430         char val[CFG_VAR_NAME_MAX];
    1431         size_t len = sizeof(val);
                        ^^^^^^^^^^^^^^^^^
len is set here.

    1432         long result;
    1433         int ret;
    1434 
    1435         ret = gmin_get_config_var(dev, is_gmin, var, val, &len);
    1436         if (!ret) {
--> 1437                 val[len] = 0;
                         ^^^^^^^^
Not all the success paths in gmin_get_config_var() set out_len.  Also
gmin_get_config_dsm_var() was problematic but I've sent a fix for that.

    1438                 ret = kstrtol(val, 0, &result);
    1439         } else {
    1440                 dev_info(dev, "%s: using default (%d)\n", var, def);
    1441         }
    1442 
    1443         return ret ? def : result;
    1444 }

regards,
dan carpenter



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux