[staging:staging-testing 209/209] drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c:72:3-8: WARNING: invalid free of devm_ allocated data (fwd)

Julia Lawall julia.lawall at lip6.fr
Wed Mar 1 10:25:37 UTC 2017


In both of the cited files (only one is shown), buffer is allocated using
devm_kzalloc, so the kfree is not appropriate.

julia

---------- Forwarded message ----------
Date: Wed, 1 Mar 2017 18:12:08 +0800
From: kbuild test robot <fengguang.wu at intel.com>
To: kbuild at 01.org
Cc: Julia Lawall <julia.lawall at lip6.fr>
Subject: [staging:staging-testing 209/209]
    drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c:72:3-8: WARNING:
    invalid free of devm_ allocated data


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing
head:   628b2b91d50c74e2475a11a0db5978d9a36d2026
commit: 628b2b91d50c74e2475a11a0db5978d9a36d2026 [209/209] staging/atomisp: Add support for the Intel IPU v2
:::::: branch date: 2 hours ago
:::::: commit date: 2 hours ago

>> drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c:72:3-8: WARNING: invalid free of devm_ allocated data
--
>> drivers/staging/media/atomisp/i2c/imx/otp_e2prom.c:82:3-8: WARNING: invalid free of devm_ allocated data

git remote add staging https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
git remote update staging
git checkout 628b2b91d50c74e2475a11a0db5978d9a36d2026
vim +72 drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c

628b2b91 Alan Cox 2017-02-17  56  		u16 addr_buf;
628b2b91 Alan Cox 2017-02-17  57  		int r;
628b2b91 Alan Cox 2017-02-17  58
628b2b91 Alan Cox 2017-02-17  59  		msg[0].flags = 0;
628b2b91 Alan Cox 2017-02-17  60  		msg[0].addr = i2c_addr;
628b2b91 Alan Cox 2017-02-17  61  		addr_buf = cpu_to_be16(addr & 0xFFFF);
628b2b91 Alan Cox 2017-02-17  62  		msg[0].len = 2;
628b2b91 Alan Cox 2017-02-17  63  		msg[0].buf = (u8 *)&addr_buf;
628b2b91 Alan Cox 2017-02-17  64
628b2b91 Alan Cox 2017-02-17  65  		msg[1].addr = i2c_addr;
628b2b91 Alan Cox 2017-02-17  66  		msg[1].flags = I2C_M_RD;
628b2b91 Alan Cox 2017-02-17  67  		msg[1].len = min(max_read_size, size - addr);
628b2b91 Alan Cox 2017-02-17  68  		msg[1].buf = &buffer[addr];
628b2b91 Alan Cox 2017-02-17  69
628b2b91 Alan Cox 2017-02-17  70  		r = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
628b2b91 Alan Cox 2017-02-17  71  		if (r != ARRAY_SIZE(msg)) {
628b2b91 Alan Cox 2017-02-17 @72  			kfree(buffer);
628b2b91 Alan Cox 2017-02-17  73  			dev_err(&client->dev, "read failed at 0x%03x\n", addr);
628b2b91 Alan Cox 2017-02-17  74  			return NULL;
628b2b91 Alan Cox 2017-02-17  75  		}
628b2b91 Alan Cox 2017-02-17  76  	}
628b2b91 Alan Cox 2017-02-17  77  	return buffer;
628b2b91 Alan Cox 2017-02-17  78
628b2b91 Alan Cox 2017-02-17  79  }
628b2b91 Alan Cox 2017-02-17  80

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation


More information about the devel mailing list