* [patch] [media] saa7164: make buffer smaller
@ 2010-11-02 3:22 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-11-02 3:22 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Steven Toth, linux-media, kernel-janitors
This isn't a runtime bug, it's just to make static checkers happy.
In vidioc_querycap() we copy a saa7164_dev ->name driver array into a
v4l2_capability -> driver array. The ->driver array is only 16 chars
long so ->name also can't be more than 16 characters.
The ->name gets set in v4l2_capability() and it always is less than 16
characters so we can easily make the buffer smaller.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
index 1d9c5cb..8b3e844 100644
--- a/drivers/media/video/saa7164/saa7164.h
+++ b/drivers/media/video/saa7164/saa7164.h
@@ -448,7 +448,7 @@ struct saa7164_dev {
int nr;
int hwrevision;
u32 board;
- char name[32];
+ char name[16];
/* firmware status */
struct saa7164_fw_status fw_status;
diff --git a/drivers/media/video/saa7164/saa7164-core.c b/drivers/media/video/saa7164/saa7164-core.c
index e1bac50..b66f78f 100644
--- a/drivers/media/video/saa7164/saa7164-core.c
+++ b/drivers/media/video/saa7164/saa7164-core.c
@@ -1001,7 +1001,7 @@ static int saa7164_dev_setup(struct saa7164_dev *dev)
atomic_inc(&dev->refcount);
dev->nr = saa7164_devcount++;
- sprintf(dev->name, "saa7164[%d]", dev->nr);
+ snprintf(dev->name, sizeof(dev->name), "saa7164[%d]", dev->nr);
mutex_lock(&devlist);
list_add_tail(&dev->devlist, &saa7164_devlist);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-11-02 3:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-02 3:22 [patch] [media] saa7164: make buffer smaller Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).