[media] saa7164: make buffer smaller
authorDan Carpenter <error27@gmail.com>
Tue, 2 Nov 2010 03:22:23 +0000 (00:22 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 29 Dec 2010 10:16:39 +0000 (08:16 -0200)
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/saa7164/saa7164-core.c
drivers/media/video/saa7164/saa7164.h

index e1bac5051460360202dcef7bf117aa0974d4f316..b66f78f7042ce469951da0d0128ebccb12e36ebd 100644 (file)
@@ -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);
index 041ae8e20f685fdd6a37831dca38862f5fa06927..74df9c627a96b29f1f7334b29cf7ab83d63471f0 100644 (file)
@@ -447,7 +447,7 @@ struct saa7164_dev {
        int     nr;
        int     hwrevision;
        u32     board;
-       char    name[32];
+       char    name[16];
 
        /* firmware status */
        struct saa7164_fw_status        fw_status;