Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1319336
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.3 067/157] ASoC: rt286: Fix run time error while modifying const data |
| Date | 2016-01-27 19:50 +0100 |
| Message-ID | <qVDkf-7RP-49@gated-at.bofh.it> (permalink) |
| References | <qVCRc-7CM-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <axel.lin@ingics.com>
commit dc6d84c69cf8296b1e8e2fd0b1e115b7787ef4e9 upstream.
Make a copy of memory for index_cache rather than directly use the
rt286_index_def to avoid run time error.
Fixes: c418a84a8c8f ("ASoC: Constify reg_default tables")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/codecs/rt286.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -38,7 +38,7 @@
#define RT288_VENDOR_ID 0x10ec0288
struct rt286_priv {
- const struct reg_default *index_cache;
+ struct reg_default *index_cache;
int index_cache_size;
struct regmap *regmap;
struct snd_soc_codec *codec;
@@ -1161,7 +1161,11 @@ static int rt286_i2c_probe(struct i2c_cl
return -ENODEV;
}
- rt286->index_cache = rt286_index_def;
+ rt286->index_cache = devm_kmemdup(&i2c->dev, rt286_index_def,
+ sizeof(rt286_index_def), GFP_KERNEL);
+ if (!rt286->index_cache)
+ return -ENOMEM;
+
rt286->index_cache_size = INDEX_CACHE_SIZE;
rt286->i2c = i2c;
i2c_set_clientdata(i2c, rt286);
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 4.3 067/157] ASoC: rt286: Fix run time error while modifying const data Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-01-27 19:50 +0100
csiph-web