From patchwork Wed Jun 19 05:32:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 11003405 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-2.web.codeaurora.org (Postfix) with ESMTP id 4627C112C for ; Wed, 19 Jun 2019 05:32:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30EE728B00 for ; Wed, 19 Jun 2019 05:32:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23F3A28B1F; Wed, 19 Jun 2019 05:32:18 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B7BFE28B00 for ; Wed, 19 Jun 2019 05:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=BdMR3l2z5vdryx1PUWDGhqQSOeJ7V/Go28RKuBGcAxE=; b=p4rZcAuL6dUufl 31wXCYQU7GZwMin9xSJrgKZmb9ZcICxOWfc9nXRpFJClDvAM8osW1e0g+iaGYtcKlsR3Yji/DnabU MachVdNNkaar8N+YoypYU8dAlpgF3ODyCA0cj6VZKfLArIBry0RT4LVCnHJQYAgze4HpJFPGz+gFC GjAHSM7LCU5vqEOtOrqrN8P0md22bp/ll3FXEEywlzwrlpeJk1N5Wukyzwk6D5DFWCAtGbpY9QW60 twkxwWym9phZ44SEe6bIjaizI9bJCi4bNeT8FdW/+GvXtc8ozCHkFINDDSSwCYT+VH9MJMfdU0bGY XPuz/l12C2g5yJc92Idg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdTCi-0004iw-Lf; Wed, 19 Jun 2019 05:32:16 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdTCf-0004iZ-OV for ath11k@lists.infradead.org; Wed, 19 Jun 2019 05:32:15 +0000 Received: from pd95fd3e4.dip0.t-ipconnect.de ([217.95.211.228] helo=bertha.fritz.box) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1hdTCd-0007Dx-1o; Wed, 19 Jun 2019 07:32:11 +0200 From: John Crispin To: Kalle Valo Subject: [PATCH] ath11k: fix mac_cap_info copy size Date: Wed, 19 Jun 2019 07:32:08 +0200 Message-Id: <20190619053208.17243-1-john@phrozen.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190618_223213_955808_6C88BE20 X-CRM114-Status: GOOD ( 10.38 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ath11k@lists.infradead.org, John Crispin Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The code currently copies the he_cap field when adding a peer from a six byte to an eight byte buffer. Switch from using the dest buffer length to that of the src buffer. Also make sure that the trailing 2 bytes are zero'ed out. Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/mac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 53177a9e3c7e..7239013b59ca 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -1262,8 +1262,9 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar, arg->he_flag = true; + memset(&arg->peer_he_cap_macinfo, 0, sizeof(&arg->peer_he_cap_macinfo)); memcpy(&arg->peer_he_cap_macinfo, he_cap->he_cap_elem.mac_cap_info, - sizeof(arg->peer_he_cap_macinfo)); + sizeof(he_cap->he_cap_elem.mac_cap_info)); memcpy(&arg->peer_he_cap_phyinfo, he_cap->he_cap_elem.phy_cap_info, sizeof(arg->peer_he_cap_phyinfo)); memcpy(&arg->peer_he_ops, &vif->bss_conf.he_operation,