Re: [PATCH] i2c-core: One function call less in acpi_i2c_space_handler() after error detection
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system] Hi Markus, [auto build test ERROR on wsa/i2c/for-next] [also build test ERROR on v4.4-rc6 next-20151223] url: https://github.com/0day-ci/linux/commits/SF-Markus-Elfring/i2c-core-One-function-call-less-in-acpi_i2c_space_handler-after-error-detection/20151226-143820 base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux i2c/for-next config: x86_64-randconfig-x010-12251849 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers/i2c/i2c-core.c: In function 'acpi_i2c_space_handler': >> drivers/i2c/i2c-core.c:404:3: error: label 'err' used but not defined goto err; ^ vim +/err +404 drivers/i2c/i2c-core.c 17f4a5c4 Wolfram Sang 2014-09-22 398 } 17f4a5c4 Wolfram Sang 2014-09-22 399 break; 17f4a5c4 Wolfram Sang 2014-09-22 400 17f4a5c4 Wolfram Sang 2014-09-22 401 default: 17f4a5c4 Wolfram Sang 2014-09-22 402 pr_info("protocol(0x%02x) is not supported.\n", accessor_type); 17f4a5c4 Wolfram Sang 2014-09-22 403 ret = AE_BAD_PARAMETER; 17f4a5c4 Wolfram Sang 2014-09-22 @404 goto err; 17f4a5c4 Wolfram Sang 2014-09-22 405 } 17f4a5c4 Wolfram Sang 2014-09-22 406 17f4a5c4 Wolfram Sang 2014-09-22 407 gsb->status = status; :: The code at line 404 was first introduced by commit :: 17f4a5c47f28de9ea59182f48d07f8c44ee5dcc9 i2c: move acpi code back into the core :: TO: Wolfram Sang :: CC: Wolfram Sang --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
[PATCH] i2c-core: One function call less in acpi_i2c_space_handler() after error detection
From: Markus Elfring Date: Sat, 26 Dec 2015 07:30:35 +0100 The kfree() function was called in one case by the acpi_i2c_space_handler() function during error handling even if the passed variable "client" contained a null pointer. Implementation details could be improved by the adjustment of jump targets. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/i2c/i2c-core.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 7349b00..a24e06c 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -313,18 +313,18 @@ acpi_i2c_space_handler(u32 function, acpi_physical_address command, client = kzalloc(sizeof(*client), GFP_KERNEL); if (!client) { ret = AE_NO_MEMORY; - goto err; + goto free_ares; } if (!value64 || ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) { ret = AE_BAD_PARAMETER; - goto err; + goto free_client; } sb = &ares->data.i2c_serial_bus; if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) { ret = AE_BAD_PARAMETER; - goto err; + goto free_client; } client->adapter = adapter; @@ -405,9 +405,9 @@ acpi_i2c_space_handler(u32 function, acpi_physical_address command, } gsb->status = status; - - err: +free_client: kfree(client); +free_ares: ACPI_FREE(ares); return ret; } -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/