summaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/si4713
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-10-15 12:24:45 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-12-18 06:40:30 -0200
commit8aab72bb0797321c6f6867f240da1e8c28bf040c (patch)
treedcfa63fee5ec3857439b0412c0b671c4f1ab0013 /drivers/media/radio/si4713
parentcc6d618fdf56df389e46be2f0c9f2d1579d8b9e6 (diff)
downloadtalos-op-linux-8aab72bb0797321c6f6867f240da1e8c28bf040c.tar.gz
talos-op-linux-8aab72bb0797321c6f6867f240da1e8c28bf040c.zip
[media] si4713: si4713_set_rds_radio_text overwrites terminating \0
si4713_set_rds_radio_text will overwrite the terminating zero at the end of the rds radio text string in order to send out a carriage return as per the RDS spec. Use a separate char buffer for the CR instead of corrupting the control string. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Tested-by: Eduardo Valentin <edubezval@gmail.com> Acked-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/radio/si4713')
-rw-r--r--drivers/media/radio/si4713/si4713.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/radio/si4713/si4713.c b/drivers/media/radio/si4713/si4713.c
index 097d4e09b491..17e0106a771b 100644
--- a/drivers/media/radio/si4713/si4713.c
+++ b/drivers/media/radio/si4713/si4713.c
@@ -831,8 +831,9 @@ static int si4713_set_rds_ps_name(struct si4713_device *sdev, char *ps_name)
return rval;
}
-static int si4713_set_rds_radio_text(struct si4713_device *sdev, char *rt)
+static int si4713_set_rds_radio_text(struct si4713_device *sdev, const char *rt)
{
+ static const char cr[RDS_RADIOTEXT_BLK_SIZE] = { RDS_CARRIAGE_RETURN, 0 };
int rval = 0, i;
u16 t_index = 0;
u8 b_index = 0, cr_inserted = 0;
@@ -856,7 +857,7 @@ static int si4713_set_rds_radio_text(struct si4713_device *sdev, char *rt)
for (i = 0; i < RDS_RADIOTEXT_BLK_SIZE; i++) {
if (!rt[t_index + i] ||
rt[t_index + i] == RDS_CARRIAGE_RETURN) {
- rt[t_index + i] = RDS_CARRIAGE_RETURN;
+ rt = cr;
cr_inserted = 1;
break;
}
OpenPOWER on IntegriCloud