From patchwork Tue Aug 2 11:19:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 9255675 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BAEFE6077C for ; Tue, 2 Aug 2016 11:26:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC190284EF for ; Tue, 2 Aug 2016 11:26:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A064B28513; Tue, 2 Aug 2016 11:26:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F323284EF for ; Tue, 2 Aug 2016 11:26:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755022AbcHBLWy (ORCPT ); Tue, 2 Aug 2016 07:22:54 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35348 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755188AbcHBLTh (ORCPT ); Tue, 2 Aug 2016 07:19:37 -0400 Received: by mail-lf0-f68.google.com with SMTP id l89so9773487lfi.2 for ; Tue, 02 Aug 2016 04:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=JMuc9IiBYB8tyeRn4hxZyFX4a2hL0tbKp/tgG/wAZIA=; b=Rriy3GRzgsuOZDSJsLlPAt+2vlCGPpbDlxANLsebv4Bn47DbUgTHWt9mgzdCIM7IoD k8B0grvoUAR/d7hAkIPgdZP5ELxtnDw0fZK+4ZrX0mvmQCjQvaTOF+b840K69UYd8HSD sJpJnqap0PgPlI/K7cB/CgIaPfSpvzXs4darA4Ij/34ag86apv37JBf7wAonn88V38Om Ib/LZUWZiV0Dg7rt3t0oa2iGGvhAc1Z52Ftc3+2pFvZx+g/rpBl1S6AhDuZf0CXIuleW U+p3bLbRkx6N6nQN7Zc+1VmoP6ULPgsDU6U3H9wvkq0NlgYIhc9iPeg47oQw2W5IXwVy WhDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=JMuc9IiBYB8tyeRn4hxZyFX4a2hL0tbKp/tgG/wAZIA=; b=OF8UlNjaJVGYlBP9HP+IT2Fi64VcuQzmWZZSKOPVeX/ZWT7fd1xMx9GtHowW7BFCoS MJtkNAATW8MVXu3QImCnfhwFa21iddXnxqKcs/uX5zuzs+LyWKXR6eFcZt2Fm+fsIU13 ht2bQN7EoptOTx0/kvtEDpATR3b4cExKVj9U8iLoBNYvDuPJsekxQ+iwZ34/rnsX3Idy qT7O33fot4EZIijEPX5yszkd9MtFLwbl5wPfzG/4so0K+t7I/aJ0JKsGCQ2rKtdLyzro QrEdOVfUtmGeg7nLRmenwlwdLhAzugzW3KD0rixGtlWFPliHlwGW1JWQLmj4S0j0nCio z/zA== X-Gm-Message-State: AEkoouuz1zL8cpjRUNcv0LArIi0IxUkNkSelbrtBJCxw+H2uJfFdGiTK8F+FWcurCmcVGg== X-Received: by 10.25.131.150 with SMTP id f144mr17154478lfd.53.1470136775397; Tue, 02 Aug 2016 04:19:35 -0700 (PDT) Received: from localhost.localdomain ([213.129.100.75]) by smtp.gmail.com with ESMTPSA id g74sm405259ljg.24.2016.08.02.04.19.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Aug 2016 04:19:34 -0700 (PDT) From: Sergey Ryazanov To: Kalle Valo Cc: Linux Wireless , Jiri Slaby , Nick Kossifidis , "Luis R . Rodriguez" Subject: [PATCH] ath5k: fix EEPROM dumping via debugfs Date: Tue, 2 Aug 2016 14:19:28 +0300 Message-Id: <1470136768-28077-1-git-send-email-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.7.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP EEPROM size calculated in 16-bit words, so we should take into account this fact during buffer allocation. CC: Jiri Slaby CC: Nick Kossifidis CC: Luis R. Rodriguez Signed-off-by: Sergey Ryazanov --- drivers/net/wireless/ath/ath5k/debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index 929d7cc..4f8d9ed 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c @@ -909,7 +909,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file) struct ath5k_hw *ah = inode->i_private; bool res; int i, ret; - u32 eesize; + u32 eesize; /* NB: in 16-bit words */ u16 val, *buf; /* Get eeprom size */ @@ -932,7 +932,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file) /* Create buffer and read in eeprom */ - buf = vmalloc(eesize); + buf = vmalloc(eesize * 2); if (!buf) { ret = -ENOMEM; goto err; @@ -952,7 +952,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file) } ep->buf = buf; - ep->len = i; + ep->len = eesize * 2; file->private_data = (void *)ep;