Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp914013rdg; Wed, 11 Oct 2023 08:54:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3NtVVzgygYjhpQOXPVLmiCHGy6HWLKNpJP9L4IPMM40uwEswi9pjR4CYK3AtxKfaazu7O X-Received: by 2002:a05:6a00:1488:b0:690:ca4e:661b with SMTP id v8-20020a056a00148800b00690ca4e661bmr22839325pfu.13.1697039662557; Wed, 11 Oct 2023 08:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697039662; cv=none; d=google.com; s=arc-20160816; b=v4tQApyBrj5eJ0yCyPHW1DEMhCsFNG1XULzhpVaYoX6GJGfdEJ0byvkXh9TC4K8/kn NJGx/gdGMn94xqwR0qZTL7XESQr4iZHVswUuB3VJYKV6WidjFRjlQ2xrEX9fTKv3eumO VqjtfWRKa8LRkws7mq7tS+IIB/pxDYeSVviV22mUbpTtZH625TdrEzAEd1rlOn/b8SwJ 2wzagT2hNQFXAZC1l4IAK2c3eqOkqt2PWLkzNo1w11o4tbPwiULD+OFvuvdYtKGIrwar g3+7qrkTyOE8bGaeFsvR6pEPZj1cFqPVQPcXe3oO8CiVjqtyMOAgk6ser4WuJRPYmHtN pGjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8Htu9vRDdlh1lnBGpIo/5HQ3QU1xFZzou/eTtTBx6bY=; fh=Y6oxoC5aMcPoKuFMOqJaEMin5ZtzSLfMUEACQYKIzi8=; b=sWxp/0U3lIrjAOvap4/KVdqDgpXH7KOHKkgsT7masUqYfcUPEZp/HeiNOaAgPSd4U7 5skLxTb7OShZh45nfnMwf/LYuI+FQCyUutw0NGNHm1j5WVe+W/Qoj23UuAas8ffzpSeL Fz7VcGOW/RwAT0X5p2a7MkCy1Ewk3i7aDvw6zedMsJEVc4QCTx+Pny4Pt+KMek44s2Sk 0XVZQDl2hRGwhzYf78ambdKgG64KIEirO3PMmvXTISXK99+P6u3ukCXGoLzIca2F+HjG kxsZfPHDZTNyWLbUhRb3hbmmsOWrMtxMnqzmjDSj2rbrOg7k21YXoEiJLqiIJZ4ECPMN PS/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LvTrZn4z; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id h36-20020a635324000000b00578acf1e8a4si48929pgb.573.2023.10.11.08.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 08:54:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LvTrZn4z; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B8FF78050039; Wed, 11 Oct 2023 08:54:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235033AbjJKPyF (ORCPT + 52 others); Wed, 11 Oct 2023 11:54:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232152AbjJKPyE (ORCPT ); Wed, 11 Oct 2023 11:54:04 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 250FF8F for ; Wed, 11 Oct 2023 08:54:02 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5859b06509cso4600597a12.2 for ; Wed, 11 Oct 2023 08:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1697039641; x=1697644441; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=8Htu9vRDdlh1lnBGpIo/5HQ3QU1xFZzou/eTtTBx6bY=; b=LvTrZn4zOjR2OcMq0Vf1sNPvUdrZNPV4V8kRu/6wEUvYerkNa0i/+RpBJ0010aINwy 2ETS9qKXO39GfP6IcBsiPYOlTQmajdV3dFivIhw4rq6StFL78LSdXOkD3y+4TlafBoy/ sr3jKUp0S/oJRR/mIH20bnxGdtO3DdQrhZW30= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697039641; x=1697644441; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8Htu9vRDdlh1lnBGpIo/5HQ3QU1xFZzou/eTtTBx6bY=; b=hhwSBUXbms/6U/iray1mGAXVekyUfeECc2XGEufpw+Hk4y4Xbpce3tlIE5dy8aZzgd aqxrEEeYm8eSk6kFK1bDdz6QyEGgU/3Cr0nMN0Bqdx6yuzv0MO6YS5AUHZ5z5P9781M6 AYEsnsCE7SnJ8fM/LZgxrhyFGaeNL+XPn34XAxqijkzFlbVxIMcZGJEa+213OS8Vbv9g 6yk0g0vSvZbatpm/7BkzoUO0kog7PfOdEmFwNM0MWs1AKRJDMc4vMGhBI2Y6G78NKXHj rL8+RYucX+JdL5TXwpIVbL9nfUoCC2LDJqQEO1CdT1h1afNp8tOvZP2GOabhh6mj5ePl xh1g== X-Gm-Message-State: AOJu0YyUXiQl2jb9mMv5b7bcUH9MXBl7r8gR+xKEw9aFMwNf9wlJkWg3 ZmPEtcpgN/mGsdM30yDroOZZeQ== X-Received: by 2002:a05:6a20:3948:b0:174:4df:e445 with SMTP id r8-20020a056a20394800b0017404dfe445mr1384340pzg.50.1697039641577; Wed, 11 Oct 2023 08:54:01 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id r4-20020a1709028bc400b001b8baa83639sm14092344plo.200.2023.10.11.08.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 08:54:01 -0700 (PDT) Date: Wed, 11 Oct 2023 08:54:00 -0700 From: Kees Cook To: Ping-Ke Shih Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org Subject: Re: [PATCH 2/2] wifi: rtw89: coex: add annotation __counted_by() to struct rtw89_btc_btf_set_mon_reg Message-ID: <202310110853.681C3AB65C@keescook> References: <20231011063725.25276-1-pkshih@realtek.com> <20231011063725.25276-2-pkshih@realtek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231011063725.25276-2-pkshih@realtek.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 08:54:06 -0700 (PDT) X-Spam-Level: ** On Wed, Oct 11, 2023 at 02:37:25PM +0800, Ping-Ke Shih wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > Use struct_size() and flex_array_size() helpers to calculate proper sizes > for allocation and memcpy(). > > Don't change logic at all, and result is identical as before. > > Cc: Kees Cook > Signed-off-by: Ping-Ke Shih Looks good too. Thanks! Reviewed-by: Kees Cook -- Kees Cook