Message ID | 20230922175207.work.576-kees@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5808214vqi; Fri, 22 Sep 2023 12:09:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE17fCOf954fV4O6y6EpSN0UnECMg/d4hhvmoDUNDp/kOukqZOi4oyxgXo1v/eiFev7klkM X-Received: by 2002:a17:902:ec90:b0:1c5:9bc0:c15b with SMTP id x16-20020a170902ec9000b001c59bc0c15bmr458070plg.44.1695409754047; Fri, 22 Sep 2023 12:09:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695409754; cv=none; d=google.com; s=arc-20160816; b=bZjPczhvtl1ObnGwg57+LYmhJaSclYHNNS02M+ztsICiUeKj40B9kKZRYqXOMOT1iS kY+4Mc8aO81AC3C54HXFo4yUrzlYRE7h6N531wVuTrBR8aM09hzcyEOtgx2YDDpVOG1J LNZY5snp8HXdajLlxeK3U2yEWQ4q3WrfJjg7tr7M89imtKQqAeEjpm9T/HcN0U0I3DW/ ObqOr9xqz8rc2bcCPy7P7gdVmaAN4wc+NOophFEfZObE/VYgVfhtzRUsQ+YG+SBXdTjA 20ytJgCU1vtL1VrBgBi4U3DnQVn7TGgLCGf5pb8XQ9m8yTU/SV0LJ/gDNkotk7HryDso U/hQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=cpqiqZm2BGAxLAQ6OdHDPuq752RxFysRxRW91bm8OjQ=; fh=3Jach10R2pYL8b5rMgPd9CnJH38MPc1BF+EATgepD/4=; b=MAelEZj9TJ8ai/MhLTPcMGhDG6TNHRhqqOsC6firQtOto10fQZIdk1DaBCN8UgxV1x AtHkIr/QxpKCW21cs0KeBDiGXOyfDmIuIbhQVTYaXGsDRtrdfv8x0EAcYgF0EeP57JqJ eivEGjSUGP3jehMtSBDtsr9ewjgCzEV6pb3ZG5nO+Dy97wHRALvoBKLAYO7JbbS+Vjjv AcL3LpNzKfeU2XqDhkx8qiWgAeyPBJYAmxUTDogSG+u3GQXWbdNr+qBjBki3HcG6vwmz LZz5DYxvP8SYf7XkqkpESYj5x28MRArxNbFSIyyRCvOfH4gZ95ptQqwID7Jov1URVMcx m0hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DPx9UYnV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id t4-20020a170902e84400b001b045d65aedsi4672886plg.228.2023.09.22.12.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 12:09:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DPx9UYnV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-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 groat.vger.email (Postfix) with ESMTP id 7D24C82662FD; Fri, 22 Sep 2023 10:54:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233687AbjIVRyO (ORCPT <rfc822;pwkd43@gmail.com> + 28 others); Fri, 22 Sep 2023 13:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233202AbjIVRxk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 22 Sep 2023 13:53:40 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04982CCE for <linux-kernel@vger.kernel.org>; Fri, 22 Sep 2023 10:52:09 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-274df3878a2so1776766a91.1 for <linux-kernel@vger.kernel.org>; Fri, 22 Sep 2023 10:52:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695405129; x=1696009929; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cpqiqZm2BGAxLAQ6OdHDPuq752RxFysRxRW91bm8OjQ=; b=DPx9UYnVDmAgv087WLH2OS4ffv1QZPJ26HCnjx7aLlOqShPOIqKp/u+i40F6pJjiFz PP3I9l907MsAiOKsC0GZGDToJFT+lDJCAD5C2KNTeDStcmpiX1Uxm43rHpr5MaHAskUP iIHd9E7rr7m5+zWJmKZQN1dM4wqgCj9EYZIlg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695405129; x=1696009929; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cpqiqZm2BGAxLAQ6OdHDPuq752RxFysRxRW91bm8OjQ=; b=h9ypotr5iicr0RqobikPbJDpyml7UKDEYPdWCzLTjtattP8AgvcrPH9/N3X5v5to/l 5XIpkg3nALYYCdbtsZT5an+/bI2guTKDg9IGZUE/F9ucVHvluW5D/LfIDvWxTSSL/AzF iC7PPUvmrJRRKMqSltUzwPLC7i/odIXP/gbddqU+qVzI9XVOIOq6B8EM9WGswq8rxtdy N61Vqy2LwXh65A7vd/V5dvMk/xUO1ciL37CXcI1geU/LRcLAeSvqMAxMnEPv7RuaQxQv bUV8KeDftqjScrcQ+O6Xb4c1NECPkkZZoeNz6u/qRyQBmFR4Qo5ZTT0+sX47+fu3Nmx3 Djqg== X-Gm-Message-State: AOJu0YxaE2RoY1J6Lp0HJKTYdVZpAh+/kC5PCzT5MWQPmpiuzcSKOTiW tHAAziqnvvKJqWXo5k47gzOpnQ== X-Received: by 2002:a17:90a:608f:b0:274:729a:bcd9 with SMTP id z15-20020a17090a608f00b00274729abcd9mr366502pji.43.1695405129127; Fri, 22 Sep 2023 10:52:09 -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 ne10-20020a17090b374a00b00277246e857esm8872pjb.23.2023.09.22.10.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 10:52:08 -0700 (PDT) From: Kees Cook <keescook@chromium.org> To: Support Opensource <support.opensource@diasemi.com> Cc: Kees Cook <keescook@chromium.org>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: [PATCH] regulator: da9063: Annotate struct da9063_regulators with __counted_by Date: Fri, 22 Sep 2023 10:52:07 -0700 Message-Id: <20230922175207.work.576-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1320; i=keescook@chromium.org; h=from:subject:message-id; bh=ZdGIk5VtLtTn1AcHf5ktUG4eqSdrMBwaMfBOFKHGDSk=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlDdRHsC8woGcucLGBBK/2VeJ7ydLTnSW6b+X8+ p9ed/qBYhOJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZQ3URwAKCRCJcvTf3G3A Jn0UEACoNbrcfq2k9xjIrqekuseq4tGHpvnrzKgvzV7tiw61SxQF7JunIspuLs34jo63kYlHjez 1maQE9Str8/eS26qLtM9+nfNH6FOgg7Qj150jrfYP87hwcjl43SORasxhYVZXPuS+KOcuUzgfEk BVt3U8+FkMOUUFCVi45OGumu/OwdfCwbbgb3CsAgqqjvWSMSpOu7tYzU3EhgRqbShtFEDI6mm/v hWvfASughriswZRRdh0lC9e577cdfeF5JKFdG3L+gXUeZSPiM81UCPkeGUrzkmlOUOpyb8+hLsr JP0ed3mZMjQgKXbKIwfyakVvTx0q4vTdF7B5v2p4I1j9LDriQm6Lp3v9XQ9+coKktG/ddH2KZ8J YAo5je8kcvHcsk7WZYj9u+WgoIoZJAXMKE/gsjuiYFJuSRfcxOnKIbgCnCrlQPw2SzI9/j1Vvg0 4eKpA4lwuCNH+bJSIEvBI5+jvJT6FlaAgKqPGyQzEcln1to1DFWoCfm2I1AjGMmNdyOrLha2OGQ kcov3mwlkJR8+q6XW3dwBE0JuRcEAvWpzBV8IH3m179Z3qQO3tpypI5E4KseKxmjYPHBRWKJOTK 40hQpD9foa4kSVvbWRIJCX7+4fQBODbBI5GX0WvmZEQxrmfxA12ST36l0nUPbBi5n56UrE8tiiP 7ewlZXF sf7w5Cfg== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 22 Sep 2023 10:54:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777765978068049362 X-GMAIL-MSGID: 1777765978068049362 |
Series |
regulator: da9063: Annotate struct da9063_regulators with __counted_by
|
|
Commit Message
Kees Cook
Sept. 22, 2023, 5:52 p.m. UTC
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 da9063_regulators.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc: Support Opensource <support.opensource@diasemi.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/regulator/da9063-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 9/22/23 11:52, Kees Cook 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 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 da9063_regulators. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Support Opensource <support.opensource@diasemi.com> > Cc: Liam Girdwood <lgirdwood@gmail.com> > Cc: Mark Brown <broonie@kernel.org> > Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Thanks
On Fri, Sep 22, 2023 at 10:52:07AM -0700, Kees Cook 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 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 da9063_regulators. Friendly ping. Mark can you pick this up? Thanks! -Kees > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Support Opensource <support.opensource@diasemi.com> > Cc: Liam Girdwood <lgirdwood@gmail.com> > Cc: Mark Brown <broonie@kernel.org> > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > drivers/regulator/da9063-regulator.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c > index a0621665a6d2..82bf321ae06f 100644 > --- a/drivers/regulator/da9063-regulator.c > +++ b/drivers/regulator/da9063-regulator.c > @@ -158,7 +158,7 @@ struct da9063_regulator { > struct da9063_regulators { > unsigned int n_regulators; > /* Array size to be defined during init. Keep at end. */ > - struct da9063_regulator regulator[]; > + struct da9063_regulator regulator[] __counted_by(n_regulators); > }; > > /* BUCK modes for DA9063 */ > -- > 2.34.1 >
On Fri, Oct 06, 2023 at 01:40:08PM -0700, Kees Cook wrote: > On Fri, Sep 22, 2023 at 10:52:07AM -0700, Kees Cook 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 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 da9063_regulators. > Friendly ping. Mark can you pick this up? Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. If there have been review comments then people may be waiting for those to be addressed. Sending content free pings adds to the mail volume (if they are seen at all) which is often the problem and since they can't be reviewed directly if something has gone wrong you'll have to resend the patches anyway, so sending again is generally a better approach though there are some other maintainers who like them - if in doubt look at how patches for the subsystem are normally handled.
On Fri, 22 Sep 2023 10:52:07 -0700, Kees Cook 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 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 da9063_regulators. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next Thanks! [1/1] regulator: da9063: Annotate struct da9063_regulators with __counted_by commit: 1096f9fa2be18a1340d1299b4c4329af211076e7 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index a0621665a6d2..82bf321ae06f 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -158,7 +158,7 @@ struct da9063_regulator { struct da9063_regulators { unsigned int n_regulators; /* Array size to be defined during init. Keep at end. */ - struct da9063_regulator regulator[]; + struct da9063_regulator regulator[] __counted_by(n_regulators); }; /* BUCK modes for DA9063 */