From patchwork Sun Mar 16 21:41:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Larsson X-Patchwork-Id: 3840451 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DE9F29F373 for ; Sun, 16 Mar 2014 21:49:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF65B2015D for ; Sun, 16 Mar 2014 21:49:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 057A92015A for ; Sun, 16 Mar 2014 21:49:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932121AbaCPVtk (ORCPT ); Sun, 16 Mar 2014 17:49:40 -0400 Received: from smtp.bredband2.com ([83.219.192.166]:46542 "EHLO smtp.bredband2.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932090AbaCPVtj (ORCPT ); Sun, 16 Mar 2014 17:49:39 -0400 X-Greylist: delayed 503 seconds by postgrey-1.27 at vger.kernel.org; Sun, 16 Mar 2014 17:49:39 EDT Received: from localhost.localdomain (92-244-23-216.customers.ownit.se [92.244.23.216]) (Authenticated sender: ed8153) by smtp.bredband2.com (Postfix) with ESMTPA id 4A80DEB57B for ; Sun, 16 Mar 2014 22:41:13 +0100 (CET) From: Benjamin Larsson To: linux-media@vger.kernel.org Subject: [PATCH] r820t: fix size and init values Date: Sun, 16 Mar 2014 22:41:13 +0100 Message-Id: <1395006073-4361-1-git-send-email-benjamin@southpole.se> X-Mailer: git-send-email 1.8.3.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Correct the initialization values at the start of the function and use proper variable sizes to prevent overflow. Signed-off-by: Benjamin Larsson --- drivers/media/tuners/r820t.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index d9ee43f..ce10c18 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -1468,7 +1468,8 @@ static int r820t_imr_prepare(struct r820t_priv *priv) static int r820t_multi_read(struct r820t_priv *priv) { int rc, i; - u8 data[2], min = 0, max = 255, sum = 0; + u16 sum = 0; + u8 data[2], min = 255, max = 0; usleep_range(5000, 6000);