From patchwork Thu Jul 22 08:50:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 113527 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6M8pIGu020345 for ; Thu, 22 Jul 2010 08:51:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755139Ab0GVIvR (ORCPT ); Thu, 22 Jul 2010 04:51:17 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:38847 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751260Ab0GVIvP (ORCPT ); Thu, 22 Jul 2010 04:51:15 -0400 Received: by fxm14 with SMTP id 14so4101237fxm.19 for ; Thu, 22 Jul 2010 01:51:13 -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=udtoD3zkqmjkDOS0qhrdPF+kfg/gcJTLfScHUlSmEiA=; b=rj218mqRhDBxC6KAeqZYtmss9FqHbb2hDHR67puuQkZCf6ICd+AIS7MPaa/C7MupyN OLPBJHBNFSErrV2z1UMCpH3Mlm2StFxt+C8W4a02yEgPIX4VEvTZMP1s6FDEz0/wEZc3 O9fKWxXqm02y7TiHTHgKL/rrEHn2f86Z8XwaY= 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=UrLWmmBeoO0UXF8q6EjWg2IB8nSnMsdUZOrSbD2m7GiqypBohut4AwTCYLqyBWPaXT /+jCM1aVfZ3DQI1yexeB2VyWO6IZiu0ZEavZK1emEycancpd/9fuYyClYRFR7z4wt1Lj suLywL3I4cEWuLTfpvuDKTO9fqP6xYlpC+oHI= Received: by 10.86.52.17 with SMTP id z17mr1327211fgz.4.1279788673496; Thu, 22 Jul 2010 01:51:13 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id q17sm3234866faa.21.2010.07.22.01.50.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 22 Jul 2010 01:51:11 -0700 (PDT) Date: Thu, 22 Jul 2010 10:50:28 +0200 From: Dan Carpenter To: "Luis R. Rodriguez" Cc: Jouni Malinen , Sujith Manoharan , Vasanthakumar Thiagarajan , Senthil Balasubramanian , "John W. Linville" , Vivek Natarajan , Felix Fietkau , linux-wireless@vger.kernel.org, ath9k-devel@venema.h4ckr.net, kernel-janitors@vger.kernel.org Subject: [patch -next] ath9k: snprintf() returns largish values Message-ID: <20100722085027.GU17585@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 22 Jul 2010 08:51:19 +0000 (UTC) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 3243877..cf9bcc6 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c @@ -524,6 +524,9 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, len += snprintf(buf + len, sizeof(buf) - len, "%19s : %10u\n", "TX Rate", priv->debug.txrate); + if (len > sizeof(buf)) + len = sizeof(buf); + return simple_read_from_buffer(user_buf, count, ppos, buf, len); } @@ -569,6 +572,9 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf, "%20s : %10u\n", "VO queued", priv->debug.tx_stats.queue_stats[WME_AC_VO]); + if (len > sizeof(buf)) + len = sizeof(buf); + return simple_read_from_buffer(user_buf, count, ppos, buf, len); } @@ -595,6 +601,9 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, "%20s : %10u\n", "SKBs Dropped", priv->debug.rx_stats.skb_dropped); + if (len > sizeof(buf)) + len = sizeof(buf); + return simple_read_from_buffer(user_buf, count, ppos, buf, len); }