Skip to contentSkip to conversation

sound/soc/codecs/88ce156-codec.c:1274:1-6: WARNING: invalid free of devm_ allocated data (fwd)

PATCH New Julia Lawall 1 participant 1 message Jun 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 65/67 sound/soc/codecs/88ce156-codec.c:1274:1-6: WARNING: invalid free of devm_ allocated data (fwd)

Hello,

The kfree on line 1274 will cause a double free error.

julia

---------- Forwarded message ----------
Date: Tue, 2 Jun 2020 14:39:15 +0800
From: kbuild test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>
Subject: [lkundrak-linux-mmp:lr/ariel 65/67]

    sound/soc/codecs/88ce156-codec.c:1274:1-6: WARNING: invalid free of devm_
    allocated data

CC: kbuild-all(a)lists.01.org
TO: "Lubomir, Rintel," <[email protected]>

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp.git lr/ariel
head:   744209eb6a53c65c03de1214febd58adbad72853
commit: 2e9965325fb254f4792fb2b6b086b12dc63f891c [65/67] p4

:::::: branch date: 11 hours ago
:::::: commit date: 11 hours ago
config: sparc-randconfig-c024-20200602 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate

coccinelle warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

sound/soc/codecs/88ce156-codec.c:1274:1-6: WARNING: invalid free of devm_ allocated data

# https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp.git/commit/?id=2e9965325fb254f4792fb2b6b086b12dc63f891c
git remote add lkundrak-linux-mmp git://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp.git
git remote update lkundrak-linux-mmp
git checkout 2e9965325fb254f4792fb2b6b086b12dc63f891c
vim +1274 sound/soc/codecs/88ce156-codec.c

27998497039d25 Lubomir Rintel 2020-05-24  1245
2e9965325fb254 Lubomir Rintel 2020-05-24  1246  static int ce156_i2c_probe(struct i2c_client *i2c)
27998497039d25 Lubomir Rintel 2020-05-24  1247  {
27998497039d25 Lubomir Rintel 2020-05-24  1248  	struct ce156_private *ce156_priv;
27998497039d25 Lubomir Rintel 2020-05-24  1249  	int ret;
27998497039d25 Lubomir Rintel 2020-05-24  1250
27998497039d25 Lubomir Rintel 2020-05-24  1251  	printk(KERN_INFO "CE156: register i2c driver successfully\n");
27998497039d25 Lubomir Rintel 2020-05-24  1252
2e9965325fb254 Lubomir Rintel 2020-05-24  1253  	ce156_priv = devm_kzalloc(&i2c->dev, sizeof(struct ce156_private), GFP_KERNEL);
27998497039d25 Lubomir Rintel 2020-05-24  1254  	if (ce156_priv == NULL)
27998497039d25 Lubomir Rintel 2020-05-24  1255  		return -ENOMEM;
27998497039d25 Lubomir Rintel 2020-05-24  1256
3c683b56c7a576 Lubomir Rintel 2020-05-24  1257  	ce156_priv->regmap = devm_regmap_init_i2c(i2c, &ce156_regmap);
3c683b56c7a576 Lubomir Rintel 2020-05-24  1258  	if (IS_ERR(ce156_priv->regmap)) {
3c683b56c7a576 Lubomir Rintel 2020-05-24  1259  		ret = PTR_ERR(ce156_priv->regmap);
3c683b56c7a576 Lubomir Rintel 2020-05-24  1260  		dev_err(&i2c->dev, "Failed to allocate regmap (%d)\n", ret);
3c683b56c7a576 Lubomir Rintel 2020-05-24  1261  		return ret;
3c683b56c7a576 Lubomir Rintel 2020-05-24  1262  	}
3c683b56c7a576 Lubomir Rintel 2020-05-24  1263
40169b41e2e888 Lubomir Rintel 2020-05-24  1264  	ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_ce156, &ce156_dai, 1);
27998497039d25 Lubomir Rintel 2020-05-24  1265
27998497039d25 Lubomir Rintel 2020-05-24  1266  	if (ret) {
27998497039d25 Lubomir Rintel 2020-05-24  1267  		printk(KERN_INFO "CE156: Failed to register codec\n");
27998497039d25 Lubomir Rintel 2020-05-24  1268  		goto out;
27998497039d25 Lubomir Rintel 2020-05-24  1269  	}
27998497039d25 Lubomir Rintel 2020-05-24  1270
27998497039d25 Lubomir Rintel 2020-05-24  1271  	return ret;
27998497039d25 Lubomir Rintel 2020-05-24  1272
27998497039d25 Lubomir Rintel 2020-05-24  1273  out:
27998497039d25 Lubomir Rintel 2020-05-24 @1274  	kfree(ce156_priv);
27998497039d25 Lubomir Rintel 2020-05-24  1275  	return -EINVAL;
27998497039d25 Lubomir Rintel 2020-05-24  1276  }

27998497039d25 Lubomir Rintel 2020-05-24 1277

:::::: The code at line 1274 was first introduced by commit :::::: 27998497039d2518d34ba88ddd721c2290a2e162 XXX 88CE156

:::::: TO: Lubomir Rintel <[email protected]>
:::::: CC: Lubomir Rintel <[email protected]>

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