From patchwork Tue Nov 2 03:22:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 4774 Return-path: Envelope-to: mchehab@gaivota Delivery-date: Mon, 01 Nov 2010 23:23:21 -0400 Received: from mchehab by gaivota with local (Exim 4.72) (envelope-from ) id 1PD7Sz-0006Fe-GM for mchehab@gaivota; Mon, 01 Nov 2010 23:23:21 -0400 Received: from casper.infradead.org [85.118.1.10] by gaivota with IMAP (fetchmail-6.3.17) for (single-drop); Mon, 01 Nov 2010 23:23:21 -0400 (EDT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PD7SC-0002nI-O9; Tue, 02 Nov 2010 03:22:33 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755535Ab0KBDWa (ORCPT + 1 other); Mon, 1 Nov 2010 23:22:30 -0400 Received: from mail-gy0-f174.google.com ([209.85.160.174]:65482 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755546Ab0KBDW3 (ORCPT ); Mon, 1 Nov 2010 23:22:29 -0400 Received: by gyg4 with SMTP id 4so3718429gyg.19 for ; Mon, 01 Nov 2010 20:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=tkh67aCrU6d8HgCm0LP9761Mh6uJJ5sD+5goYV1U14Q=; b=NJKutt9RY54E64wajPTRWv6nnBRXx1R9lOrYbO3GwnVBBqYsfopdqmOG4Bon7TvEKi zlPYqcKcBh43vK6nf9NH7LP/nv/ouLI1FQBzfGsirvssO7hAT5mXsyEINsCqhbve2lyk 7Dw5D0UXJ4PC9KmnfezupOIg/JubB0CETMUzg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=ffnSnZriZhHK9cF8y9PdIdfA9GCSnYQiBkimrAhn+hRbjIeRzupRZGE65yWhC/XyyR aTasMxbgI/6teyz7pO+3ksGvrnpymx/RScgXdPi6m+lVVwCToL7DIxPa5eVYtK8qctmU 4xr+kzcHFayPjleDdj4piMFEQpinPAzyRgDn8= Received: by 10.229.215.1 with SMTP id hc1mr10002010qcb.3.1288668148743; Mon, 01 Nov 2010 20:22:28 -0700 (PDT) Received: from bicker (pool-173-48-174-55.bstnma.fios.verizon.net [173.48.174.55]) by mx.google.com with ESMTPS id h28sm2718270vcr.19.2010.11.01.20.22.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 01 Nov 2010 20:22:27 -0700 (PDT) Date: Tue, 2 Nov 2010 05:22:23 +0200 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Steven Toth , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] [media] saa7164: make buffer smaller Message-ID: <20101102032223.GD14069@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Mauro Carvalho Chehab 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 --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);