Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp6030289rdb; Mon, 18 Sep 2023 01:36:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrxZrI8v9Bxbu1oz8byJq6vvTDOe20Sqcxs4BHp+8PZWMf3XS9p8pV6VC4BLmeUIMfMiFg X-Received: by 2002:a05:6870:3906:b0:1d6:5317:82cd with SMTP id b6-20020a056870390600b001d6531782cdmr10705474oap.34.1695026198403; Mon, 18 Sep 2023 01:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695026198; cv=none; d=google.com; s=arc-20160816; b=ZhS+5rpoX7sDqBir7tiF8adFlgMrKYv5NBqmYSlMSmBJ8WX61TuBPy4auPyqd/PgNR jTpw2uDbZAH19B1vg/0gcJOnMBN7cJygfTQnjeuO0HAA4Uo4hI63g9SAZci1Gj9KvvfR ImDoOa1gCwezmVERXodxcvr9XsGkZVenTN+R0tBVLQrhDaGdZTwRguxTUdt/uPrXaqao +doHYHIlnFr0lPj/TixyDPfRpqjJhOJBalzbNmWKGeY6wK4DRp+cJZRdTVocMPP5K+ZE ac/HwMhS7bNhtOKOSnpHTbqPN2qa0qVz6rFss1qSt7Iv0zQ6bxZBXaK9ZYrI2Cn9wttr aaBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=NrP0XvZ6N3hI1TBEc9rwseAjjzXuH4K02UQxHvBGF8s=; fh=DmK88ouVLrdBlmjobdKe0BhiOyrhezOUl+6iJcuxEjI=; b=OpMBD1XGnW7kByL2nOENKo4w5EAfJOI/q0LYupH1Z2YJBouU0D6FrM1EU+DvMJXffM mIHaXH9Z2+i9aDEC0j563aZz9AyzQi1i5hWnhgctRcsF1hBiIMDsCeh3+VOxHFzQbzfS Ju2XFawVHBNQt/1KHkMxGAr91YpQmUWWiiWSST5p4rK8tf/rcLe+6N5eQhzl1oGyMs1Y EbDN8cQBqfaLT1Sv7fBAPcKruLPsdtr8F+G4w0mFj6S6MooxrI/5sewVHBRtd6dj0fov 5X4nP/h4Ly0V5hdPgCRPaL7IXX9G+QYd5g8kW8HqvllLS4S8lGDqdxSrAqpKaJNPM4Xt uoww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ckplOVZB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u2-20020a654c02000000b0057768a32896si7679033pgq.365.2023.09.18.01.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 01:36:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ckplOVZB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D95FD82C516F; Mon, 18 Sep 2023 01:28:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240687AbjIRI23 (ORCPT + 99 others); Mon, 18 Sep 2023 04:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240690AbjIRI17 (ORCPT ); Mon, 18 Sep 2023 04:27:59 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EBF291; Mon, 18 Sep 2023 01:27:51 -0700 (PDT) Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 0FBA066072F2; Mon, 18 Sep 2023 09:27:49 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695025670; bh=q/RnJBMS2Bz4pnBRsyhr6AWWkU5fbRLwj6dY2Bv2yJ4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ckplOVZBWtmlF6AlYh711gtncHl8omA0WfIROZXv1zTmLyRfS7OCcC7Jg7tRHp1ls TofKCZZYZKOZMMe97UmjvxcUxA7/tLUk9wtOWRgiaILyqDeRwa5yUAFzOvfSL5qfRI QEZQlKkIuoGJ3EBqFwT7cXGswWtaAXWzzSNLejr7sdEGK5rCbpyFJDxyKHlrwJj0F1 a2tFQ5YGVOuM7NyLmA7CfOqVxnJ3RaNnOPoR+k8+krJl6urqU3wHhhLehm76WN1q7F NI/XdpDD2VVPJXMTb/eChBEE2b6MQiDPtr7LXSOJb/qkzX1idE/gqcHiqZTD4seIi8 fwgJ+BgXjamsg== Message-ID: <77d5d2d2-5939-e43c-9f1c-d115274ad1ef@collabora.com> Date: Mon, 18 Sep 2023 10:27:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH] leds: mt6370: Annotate struct mt6370_priv with __counted_by Content-Language: en-US To: Kees Cook , Pavel Machek Cc: Lee Jones , Matthias Brugger , Alice Chen , Jacek Anaszewski , ChiYuan Huang , ChiaEn Wu , kernel test robot , linux-leds@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org References: <20230915201051.never.429-kees@kernel.org> From: AngeloGioacchino Del Regno In-Reply-To: <20230915201051.never.429-kees@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 18 Sep 2023 01:28:58 -0700 (PDT) Il 15/09/23 22:10, Kees Cook ha scritto: > 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 checking via CONFIG_UBSAN_BOUNDS > (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct mt6370_priv. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Pavel Machek > Cc: Lee Jones > Cc: Matthias Brugger > Cc: AngeloGioacchino Del Regno > Cc: Alice Chen > Cc: Jacek Anaszewski > Cc: ChiYuan Huang > Cc: ChiaEn Wu > Cc: kernel test robot > Cc: linux-leds@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-mediatek@lists.infradead.org > Signed-off-by: Kees Cook Reviewed-by: AngeloGioacchino Del Regno