Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp542506pxb; Thu, 19 Nov 2020 07:44:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1NRgrFSXDq8slegvX4D4ae3gt/rgVReP0zvKeCcLe/FbgUdir5TILwuGKtU/mW6JW3+ht X-Received: by 2002:a17:906:3102:: with SMTP id 2mr31424642ejx.135.1605800651429; Thu, 19 Nov 2020 07:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605800651; cv=none; d=google.com; s=arc-20160816; b=WqiokoX6JLlRUmcXbksL0C3Yui4wjc8+tIqXvkj8ztPjUrcabLmcWzsscxk8ICLeqK V6mfkrWzqxoAwwLue3vGbsOxvTVvNe5E8BWhFyKBtP6JxC1TZugSKo9Tq7jaL0N4Xy3m JOofiLtkI78EsWCnjjrk5x1Kpe1kPI79P2xtdrBdCK7i2sZLNrqh50VndAeAtg+uPUWY MdcLhy0UZc8sz//k3rEPSnzMxY2LWm3iW6+dnRujckfhX2x0JAVYroACEGzDJwtdTz9j jJB86wkAHkTtWQ9QP27aFJ6QYGBW2BnUqgweCOnQje/m2Ns4YDPCYoQCz1/mDkVpItiH NKBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=43FZ+/TdGBajMA2LNqqNuOqD0RatlQ1neJSWUkj9RBA=; b=xnW9vlhEbnPQxwf+OWhFdOEY89TLLfYwKrHaWAY0ihyDHZLn0uY4cgtk0Y882Fm4oO kdpCSaUGmF2Ftk0f51PiCVJwmqobRfQx5n15UzipQij/SejMxygFy1VkCv9B2HTI7lcC SEdeCoG7NHDsGsiX1wck6uI+7YKRSM6IQfRuDzbOLr86bv6F5rlt7+Z0ETMIDxO/ZXut adN4Azagl8ROjNlkfX+/r3biITAC4ZCeXTw9bHpIVkGdRMw7RGZ7jF5h2kWsiBVhkxH0 HIn/s63e06kn9L9XLAbo5SQLhWUR770Ku6wm5lLTBu47kjG5dzURbiC8nfawgIfnrVje GdkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@narfation.org header.s=20121 header.b=mrYWkdfT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=narfation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j20si28768eja.715.2020.11.19.07.43.40; Thu, 19 Nov 2020 07:44:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@narfation.org header.s=20121 header.b=mrYWkdfT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=narfation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728641AbgKSPm7 (ORCPT + 99 others); Thu, 19 Nov 2020 10:42:59 -0500 Received: from dvalin.narfation.org ([213.160.73.56]:45332 "EHLO dvalin.narfation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728560AbgKSPm7 (ORCPT ); Thu, 19 Nov 2020 10:42:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1605800577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=43FZ+/TdGBajMA2LNqqNuOqD0RatlQ1neJSWUkj9RBA=; b=mrYWkdfTU7coh6gm07VMzThi5qgJXor/KDf1X2GAfUGO3cqHgvaCYEF32B58J22Gy3fX6H 4iRK+HDT9FkJLlEgc4JggxdHKDVkFUTXe9P7sbP6INaaa8ZlbuIDgTKC2WiFEdclZrbc0E kuKy+Z6FajCrsCtO634b0Aa2GG7OHOM= From: Sven Eckelmann To: ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Sven Eckelmann Subject: [PATCH v2 3/3] ath11k: Build check size of ath11k_skb_cb Date: Thu, 19 Nov 2020 16:42:34 +0100 Message-Id: <20201119154235.263250-3-sven@narfation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201119154235.263250-1-sven@narfation.org> References: <20201119154235.263250-1-sven@narfation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org It is rather easy to add more entries to ath11k_skb_cb while forgetting the size limit of ieee80211_tx_info->driver_data. So just check this during the build to reduce the change of accidental buffer overflow in the skbuff->cb. Signed-off-by: Sven Eckelmann --- v2: - new patch drivers/net/wireless/ath/ath11k/core.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 5a7915f75e1e..b5ca4455b2e0 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -909,6 +909,8 @@ static inline const char *ath11k_scan_state_str(enum ath11k_scan_state state) static inline struct ath11k_skb_cb *ATH11K_SKB_CB(struct sk_buff *skb) { + BUILD_BUG_ON(sizeof(struct ath11k_skb_cb) > + IEEE80211_TX_INFO_DRIVER_DATA_SIZE); return (struct ath11k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data; } -- 2.29.2