All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cx25821: Remove bad strcpy to read-only char*
@ 2012-07-18 17:41 Ezequiel Garcia
  2012-07-19 11:17 ` Hans Verkuil
  0 siblings, 1 reply; 5+ messages in thread
From: Ezequiel Garcia @ 2012-07-18 17:41 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, Ezequiel Garcia

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.

Reported-by: Radek Masin <radek@masin.eu>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
---
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(-)

diff --git a/drivers/media/video/cx25821/cx25821-core.c b/drivers/media/video/cx25821/cx25821-core.c
index 83c1aa6..f11f6f0 100644
--- a/drivers/media/video/cx25821/cx25821-core.c
+++ b/drivers/media/video/cx25821/cx25821-core.c
@@ -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);
diff --git a/drivers/media/video/cx25821/cx25821.h b/drivers/media/video/cx25821/cx25821.h
index b9aa801..029f293 100644
--- a/drivers/media/video/cx25821/cx25821.h
+++ b/drivers/media/video/cx25821/cx25821.h
@@ -187,7 +187,7 @@ enum port {
 };
 
 struct cx25821_board {
-	char *name;
+	const char *name;
 	enum port porta;
 	enum port portb;
 	enum port portc;
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] cx25821: Remove bad strcpy to read-only char*
  2012-07-18 17:41 [PATCH] cx25821: Remove bad strcpy to read-only char* Ezequiel Garcia
@ 2012-07-19 11:17 ` Hans Verkuil
  2012-07-19 13:32   ` Ezequiel Garcia
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Verkuil @ 2012-07-19 11:17 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: Mauro Carvalho Chehab, linux-media

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

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.
> 
> Reported-by: Radek Masin <radek@masin.eu>
> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
> ---
> 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(-)
> 
> diff --git a/drivers/media/video/cx25821/cx25821-core.c b/drivers/media/video/cx25821/cx25821-core.c
> index 83c1aa6..f11f6f0 100644
> --- a/drivers/media/video/cx25821/cx25821-core.c
> +++ b/drivers/media/video/cx25821/cx25821-core.c
> @@ -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);
> diff --git a/drivers/media/video/cx25821/cx25821.h b/drivers/media/video/cx25821/cx25821.h
> index b9aa801..029f293 100644
> --- a/drivers/media/video/cx25821/cx25821.h
> +++ b/drivers/media/video/cx25821/cx25821.h
> @@ -187,7 +187,7 @@ enum port {
>  };
>  
>  struct cx25821_board {
> -	char *name;
> +	const char *name;
>  	enum port porta;
>  	enum port portb;
>  	enum port portc;
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cx25821: Remove bad strcpy to read-only char*
  2012-07-19 11:17 ` Hans Verkuil
@ 2012-07-19 13:32   ` Ezequiel Garcia
  2012-07-19 13:41     ` Hans Verkuil
  0 siblings, 1 reply; 5+ messages in thread
From: Ezequiel Garcia @ 2012-07-19 13:32 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Mauro Carvalho Chehab, linux-media

On Thu, Jul 19, 2012 at 8:17 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cx25821: Remove bad strcpy to read-only char*
  2012-07-19 13:32   ` Ezequiel Garcia
@ 2012-07-19 13:41     ` Hans Verkuil
  2012-07-24 16:50       ` Ezequiel Garcia
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Verkuil @ 2012-07-19 13:41 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: Mauro Carvalho Chehab, linux-media

On Thu 19 July 2012 15:32:21 Ezequiel Garcia wrote:
> On Thu, Jul 19, 2012 at 8:17 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> > 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?

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

Regards,

	Hans

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cx25821: Remove bad strcpy to read-only char*
  2012-07-19 13:41     ` Hans Verkuil
@ 2012-07-24 16:50       ` Ezequiel Garcia
  0 siblings, 0 replies; 5+ messages in thread
From: Ezequiel Garcia @ 2012-07-24 16:50 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Mauro Carvalho Chehab, linux-media

Hey Hans,

On Thu, Jul 19, 2012 at 10:41 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> On Thu 19 July 2012 15:32:21 Ezequiel Garcia wrote:
>> On Thu, Jul 19, 2012 at 8:17 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
>> > 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?
>
> 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: stable@vger.kernel.org
   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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-24 16:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-18 17:41 [PATCH] cx25821: Remove bad strcpy to read-only char* Ezequiel Garcia
2012-07-19 11:17 ` Hans Verkuil
2012-07-19 13:32   ` Ezequiel Garcia
2012-07-19 13:41     ` Hans Verkuil
2012-07-24 16:50       ` Ezequiel Garcia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.