Skip to contentSkip to conversation

cx25821: Remove bad strcpy to read-only char*

PATCH In review Ezequiel Garcia 2 participants 5 messages Jul 18, 2012 – Jul 24, 2012 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cx25821: Remove bad strcpy to read-only char*

The strcpy was being used to set the name of the board. This was both wrong and redundant,
since the destination char* was read-only and the name is set statically at compile time.

The type of the name field is changed to const char* to prevent future errors.

---
Hi Mauro,

I believe without this patch cx25821 driver
is completely unusable.

So perhaps this patch should also go to stable tree? I'm a bit unsure about this procedure.

Regards,
Ezequiel.

---
 drivers/media/video/cx25821/cx25821-core.c |    3 ---
 drivers/media/video/cx25821/cx25821.h      |    2 +-
 2 files changed, 1 insertions(+), 4 deletions(-)
drivers/media/video/cx25821/cx25821-core.c +0 -3
index 83c1aa6..f11f6f0 100644
@@ -904,9 +904,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
 	list_add_tail(&dev->devlist, &cx25821_devlist);
 	mutex_unlock(&cx25821_devlist_mutex);
 
-	strcpy(cx25821_boards[UNKNOWN_BOARD].name, "unknown");
-	strcpy(cx25821_boards[CX25821_BOARD].name, "cx25821");
-
 	if (dev->pci->device != 0x8210) {
 		pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n",
 			__func__, dev->pci->device);
drivers/media/video/cx25821/cx25821.h +1 -1
index b9aa801..029f293 100644
@@ -187,7 +187,7 @@ enum port {
 };
 
 struct cx25821_board {
-	char *name;
+	const char *name;
 	enum port porta;
 	enum port portb;
 	enum port portc;
Signature · 1 line
1.7.4.4
#1 lore raw

Ezequiel,

Can you post this patch again, but this time to Linus Torvalds as well?

See e.g. http://www.spinics.net/lists/linux-media/msg50407.html how I did that.

It would be good to have this fixed in 3.5. I'm afraid that by the time Mauro is back 3.5 will be released and this is a nasty bug.

Regards,

Hans

Quoted 55 lines · On Wed 18 July 2012 19:41:11 Ezequiel Garcia wrote:

The strcpy was being used to set the name of the board. This was both wrong and redundant,
since the destination char* was read-only and the name is set statically at compile time.

The type of the name field is changed to const char* to prevent future errors.

---
Hi Mauro,

I believe without this patch cx25821 driver
is completely unusable.

So perhaps this patch should also go to stable tree? I'm a bit unsure about this procedure.

Regards,
Ezequiel.

---
 drivers/media/video/cx25821/cx25821-core.c |    3 ---
 drivers/media/video/cx25821/cx25821.h      |    2 +-
 2 files changed, 1 insertions(+), 4 deletions(-)
drivers/media/video/cx25821/cx25821-core.c +0 -3
index 83c1aa6..f11f6f0 100644
@@ -904,9 +904,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
 	list_add_tail(&dev->devlist, &cx25821_devlist);
 	mutex_unlock(&cx25821_devlist_mutex);
 
-	strcpy(cx25821_boards[UNKNOWN_BOARD].name, "unknown");
-	strcpy(cx25821_boards[CX25821_BOARD].name, "cx25821");
-
 	if (dev->pci->device != 0x8210) {
 		pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n",
 			__func__, dev->pci->device);
drivers/media/video/cx25821/cx25821.h +1 -1
index b9aa801..029f293 100644
@@ -187,7 +187,7 @@ enum port {
 };
 
 struct cx25821_board {
-	char *name;
+	const char *name;
 	enum port porta;
 	enum port portb;
 	enum port portc;
#2 lore raw
Quoted 9 lines · Hans Verkuil

Ezequiel,

Can you post this patch again, but this time to Linus Torvalds as well?

See e.g. http://www.spinics.net/lists/linux-media/msg50407.html how I did that.

It would be good to have this fixed in 3.5. I'm afraid that by the time Mauro is back 3.5 will be released and this is a nasty bug.

Okey, I'll do that. Shouldn't this go to stable also?

Thanks for your help,
Ezequiel.

#3 lore raw
Quoted 5 lines · On Thu 19 July 2012 15:32:21 Ezequiel Garcia wrote:
Quoted 4 lines · Hans Verkuil

Ezequiel,

Can you post this patch again, but this time to Linus Torvalds as well?

Quoted 7 lines
Quoted 5 lines

See e.g. http://www.spinics.net/lists/linux-media/msg50407.html how I did that.

It would be good to have this fixed in 3.5. I'm afraid that by the time Mauro is back 3.5 will be released and this is a nasty bug.

Okey, I'll do that. Shouldn't this go to stable also?

Definitely, but it have to be upstreamed first before it can go to stable.

Regards,

Hans

#4 lore raw

Hey Hans,

Quoted 8 lines · Hans Verkuil
Quoted 7 lines · On Thu 19 July 2012 15:32:21 Ezequiel Garcia wrote:
Quoted 6 lines · Hans Verkuil

Ezequiel,

Can you post this patch again, but this time to Linus Torvalds as well?

See e.g. http://www.spinics.net/lists/linux-media/msg50407.html how I did that.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

It would be good to have this fixed in 3.5. I'm afraid that by the time Mauro is back 3.5 will be released and this is a nasty bug.

Okey, I'll do that. Shouldn't this go to stable also?

Definitely, but it have to be upstreamed first before it can go to stable.

I was just reading through Documentation/stable_kernel_rules.txt and I found this:

"Procedure for submitting patches to the -stable tree:

[snip]
- To have the patch automatically included in the stable tree, add the tag
Cc: [email protected]
in the sign-off area. Once the patch is merged it will be applied to the stable tree without anything else needing to be done by the author or subsystem maintainer."

So, it was sufficient to Cc this patch to stable and Greg would queued it automatically when Linus' merges it.

This is also here:
http://www.kroah.com/log/linux/stable-status-01-2012.html

Just wanted you to know this (if you don't already). Ezequiel.