Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1030500lqo; Fri, 17 May 2024 08:42:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZcBatafRJda5xLVl0Br9YwJsU3WRnCwEbh64aWBjAArzu560dYI6BjnxgyX5x1bvtUMQiUfNPEg609wk9EzzwuQHFuA/uqRFJOrMMIA== X-Google-Smtp-Source: AGHT+IHswvxTe32aYYTsn3egvgNaVpdc4lv1P6X8D2Uo4p73RBOd4giRunCFgpRef8aWlG49C4QP X-Received: by 2002:a05:6a20:1013:b0:1af:b89b:a7f5 with SMTP id adf61e73a8af0-1afde0dc7cfmr18706361637.24.1715960552414; Fri, 17 May 2024 08:42:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715960552; cv=pass; d=google.com; s=arc-20160816; b=PQHU24dAAMJKcYq6WogqCviG1I/uSTkkpzy8AWFfZ9XJgm0nhtrEZ03bNoy7ysfWn+ v2BZLs1SPYAITghzYyGEpeOIY7MjZ1gxidknWZ7bLuCAaLvI8kmyIdPUKv6P0MibCSLB 6nwIRuqSZVKtqjF/mqEOeByD622E729F4GRJcJ0ksg3EfcUq06mZ8h7P9AE/2R7BXHUz 7cOKnNvo2j8EN4SM5VqWuu+AOyBhOq6VdeQ1aDWbJD3MBD1O1RgnV2IBPMLvA55UdQT0 zvNnjsKwU+7Cs3sXcBLRUl7w8T+t8y49bTNHB0wTHIMg0W4BX//2HHAla3rf97Z7G3c3 KNxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=JzV/mk6KMC1LwaV1EcKob7gOE3lv1oBnCWZ0hjperVQ=; fh=s7iCXePv5sDIb6YuoGGYNxrO/zNMR78KrqJ4afN3auI=; b=IO0aAZu3aKje1Y9lwYfMFGeIklE1YsN+9JpUYevP3+mMG6cVimgGSA6TR1+wwlO1Es 03fGVNxjx0W96L48x+1OKVA1Cci78q/vEn2sMoBZ8/qHi/j5yPVwcd8VmHpgHY+VEfD8 6pkAaeQu8rDcuJB91IOrl78VSIG/P1acGH3PDvnrS8dAq1byHthApANwB9W9zvvF8En+ /4Xppu2AbEWxql3zk/4V+bSc/yG3ACSwyJE2pmnz2YDyNkcXAvKR08x5dMFpboCEZ8Pl X9SVTK3OSv0XoC0WIqgTnj0NHHc9h3oz2EYQCHDV75d0yRL1nC5gSN8MQbdUuxGhoISp 1PKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=dKW9lrvO; arc=pass (i=1 spf=pass spfdomain=yandex.ru dkim=pass dkdomain=yandex.ru dmarc=pass fromdomain=yandex.ru); spf=pass (google.com: domain of linux-wireless+bounces-7789-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7789-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-634103f5518si17367369a12.292.2024.05.17.08.42.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 08:42:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7789-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=dKW9lrvO; arc=pass (i=1 spf=pass spfdomain=yandex.ru dkim=pass dkdomain=yandex.ru dmarc=pass fromdomain=yandex.ru); spf=pass (google.com: domain of linux-wireless+bounces-7789-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7789-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6721528735D for ; Fri, 17 May 2024 15:41:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 943A412FB02; Fri, 17 May 2024 15:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="dKW9lrvO" X-Original-To: linux-wireless@vger.kernel.org Received: from forward201c.mail.yandex.net (forward201c.mail.yandex.net [178.154.239.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 536E912F398; Fri, 17 May 2024 15:41:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.154.239.220 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715960466; cv=none; b=DjPYO4oiT4ePQKmF/O3byrZ9lFi4ycCEL7Vhb9SjtQ3T2861H5QNavXh1FPrwe208mWAQk4KZLrblcAsNtgptXdSQA4CwTxxG2L7PuAOXCh/iHxMW++W4ZbKV8L9EmNcqBvvilZA70Zgm7buZLz7IUCOY3omlDJz6m5d3+wPywE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715960466; c=relaxed/simple; bh=0u2MHk2i9OZen3eMY5VE2Cb74f2yioPtycCuCasj6J8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=h6UCTJE9oMxe4lKkn7TWE4bWgfhfxy9jGrM5g8XHp/upSM+iwN59QrmBS9Y/RsHrTy3oNQx2LbibmXGGq8Td4QQL2CAy+6jI9NC8ZqwETy1HCGLikQFw1r3oFhPfqw3lHuPFTqF1+UnvZT7gK8IHV5qaCN+yGtZcSFh4PjnNlF0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=dKW9lrvO; arc=none smtp.client-ip=178.154.239.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Received: from forward101b.mail.yandex.net (forward101b.mail.yandex.net [IPv6:2a02:6b8:c02:900:1:45:d181:d101]) by forward201c.mail.yandex.net (Yandex) with ESMTPS id 3F2B763FC0; Fri, 17 May 2024 18:33:46 +0300 (MSK) Received: from mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:de2c:0:640:e39b:0]) by forward101b.mail.yandex.net (Yandex) with ESMTPS id E3D65608DE; Fri, 17 May 2024 18:33:37 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id aXHWQ33Zu8c0-K37bRVuG; Fri, 17 May 2024 18:33:37 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1715960017; bh=JzV/mk6KMC1LwaV1EcKob7gOE3lv1oBnCWZ0hjperVQ=; h=Message-ID:Date:Cc:Subject:To:From; b=dKW9lrvOtG0OM5bXZhLrxQYLKDmB5VKtw/mmIY85H9iZSNUKrg/wNcUmXVmRRSdjv KfsIWvfv0VBzgQJxMhWXRo/ZvA0itHohehslvNCvgtXA2cQ0LPz46N1A7K2CjmWpWF 7jWDHpTKeQDe1ddFRfxB8kij+knT8YAkkuI+2aiA= Authentication-Results: mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Johannes Berg , Kees Cook , linux-wireless@vger.kernel.org, linux-hardening@vger.kernel.org Cc: Dmitry Antipov Subject: [PATCH 1/2] wifi: cfg80211: use __counted_by where appropriate Date: Fri, 17 May 2024 18:33:31 +0300 Message-ID: <20240517153332.18271-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.45.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Annotate 'sub_specs' of 'struct cfg80211_sar_specs', 'channels' of 'struct cfg80211_sched_scan_request', 'channels' of 'struct cfg80211_wowlan_nd_match', and 'matches' of 'struct cfg80211_wowlan_nd_info' with '__counted_by' attribute. Briefly tested with clang 18.1.1 and CONFIG_UBSAN_BOUNDS running iwlwifi. Signed-off-by: Dmitry Antipov --- include/net/cfg80211.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index cbf1664dc569..d79180bec7a1 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2200,7 +2200,7 @@ struct cfg80211_sar_sub_specs { struct cfg80211_sar_specs { enum nl80211_sar_type type; u32 num_sub_specs; - struct cfg80211_sar_sub_specs sub_specs[]; + struct cfg80211_sar_sub_specs sub_specs[] __counted_by(num_sub_specs); }; @@ -2838,7 +2838,7 @@ struct cfg80211_sched_scan_request { struct list_head list; /* keep last */ - struct ieee80211_channel *channels[]; + struct ieee80211_channel *channels[] __counted_by(n_channels); }; /** @@ -3582,7 +3582,7 @@ struct cfg80211_coalesce { struct cfg80211_wowlan_nd_match { struct cfg80211_ssid ssid; int n_channels; - u32 channels[]; + u32 channels[] __counted_by(n_channels); }; /** @@ -3596,7 +3596,7 @@ struct cfg80211_wowlan_nd_match { */ struct cfg80211_wowlan_nd_info { int n_matches; - struct cfg80211_wowlan_nd_match *matches[]; + struct cfg80211_wowlan_nd_match *matches[] __counted_by(n_matches); }; /** -- 2.45.1