Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1727728rwl; Thu, 30 Mar 2023 00:13:59 -0700 (PDT) X-Google-Smtp-Source: AKy350YLxEBtSQjdFp+u3UEbUVbD+wccYpFKNrNU87Qrmnlgek5KIccMhg8noq/VroZTOdqnonn7 X-Received: by 2002:a17:906:49:b0:930:aa02:f9cf with SMTP id 9-20020a170906004900b00930aa02f9cfmr1138362ejg.2.1680160439164; Thu, 30 Mar 2023 00:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680160439; cv=none; d=google.com; s=arc-20160816; b=ieV5ATb5Ag58VVa2dxm99xYomYwqDMXyUVvZDEJAOnNF9ziXQhZrcKXrQRCbNpAbOh bTTj5dyANG5fg+jV9Y4eFVXVCQMHbe2V4SRfOZVMj2z5HNdmcY5edfmxRFcU2/KZJzDC y1tKreTZIsLPTUqnjdc0FRuqCGHBOxnKu4bdR7jwkwJHz4ctmJhPZ+aWbV/iLH7/F8dl hb6UCNeKXd8cooJcCRd1PoxthUZZfN62y48ZiTYZsAhg/CTULcJQ2nvi4OMgX7pzJ54k 47cCH4VbjT4T3vlBwLKOYqqu+vcArAFd59laWfyv6Ig4Mdo9gY/v87iSRKbOinNPz3Oj yOKQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tRpF4HbdNd1PKk9nD7KS3YiOgpeBMkwiak5Ax1x0Ic4=; b=lhzy4liw8PxAn/sdS6FaxjOW1bXJP74X1oDGUOPuemaE4lEP0ESJMBZy+cJbe1fflM 0UMBZszptcN4sCJe8SXAq9GBu+z1NXvpJe/awqrsDarIw4ZRf4/1PJotAT6ZYks9M+10 d85jd8gpj3RaANjx/a6JsS3V32UYEsxKXwwoOuiuJqBE45muaGB3LnUL52KeDtWtQWUm F+wj5YCL++IHUAK9Rj24zMG9oDiAEfdudoFREiO0Qr3IBX72NUBvCX5kFS88RKqqwzsR +mrE9egRgf8y+eHLmHfPWpCaU+wQBP3rhKcfb7B1QrJlqRD+SvTUibQd5qDG1KFnvPFm M6PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yDbWpIeQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gv21-20020a170906f11500b00923d4d2b668si33347969ejb.120.2023.03.30.00.13.34; Thu, 30 Mar 2023 00:13:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yDbWpIeQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229942AbjC3HL2 (ORCPT + 99 others); Thu, 30 Mar 2023 03:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229835AbjC3HLX (ORCPT ); Thu, 30 Mar 2023 03:11:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9299365B7; Thu, 30 Mar 2023 00:11:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 27937B8261C; Thu, 30 Mar 2023 07:11:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55B75C433D2; Thu, 30 Mar 2023 07:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680160279; bh=FlHNhQJDZf7ntHD5KuZYR/u8hEWLq2oX8p0cp1xWcnk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yDbWpIeQYpXhHJfU8tR8TtzS3ra1g3m/xwutUVSeNMOAvnYaWZDzkTLbhewU7Zihj +yYCVMAIQa5Rl3+Q42HNR2OwtHnRmlJ5MH0WarVfORtMsbGmjrJnZKsiaDXYHSmcBf U9Wa226GR9b6wjAwnhPpUj1AOUF5Neb4bo0b5d+o= Date: Thu, 30 Mar 2023 09:11:16 +0200 From: Greg KH To: Tzung-Bi Shih Cc: "Gustavo A. R. Silva" , Benson Leung , Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] platform/chrome: Fix -Warray-bounds warnings Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 On Thu, Mar 30, 2023 at 03:01:23PM +0800, Tzung-Bi Shih wrote: > On Wed, Mar 29, 2023 at 07:54:02PM -0600, Gustavo A. R. Silva wrote: > > In this case, as only enough space for the op field is allocated, > > we can use an object of type uint32_t instead of a whole > > struct ec_params_vbnvcontext (for which not enough memory is > > allocated). > > It doesn't make sense to me. See comments below. > > > Fix the following warning seen under GCC 13: > > drivers/platform/chrome/cros_ec_vbc.c: In function ‘vboot_context_read’: > > drivers/platform/chrome/cros_ec_vbc.c:36:15: warning: array subscript ‘struct ec_params_vbnvcontext[1]’ is partly outside array bounds of ‘unsigned char[36]’ [-Warray-bounds=] > > 36 | params->op = EC_VBNV_CONTEXT_OP_READ; > > | ^~ > > In file included from drivers/platform/chrome/cros_ec_vbc.c:12: > > In function ‘kmalloc’, > > inlined from ‘vboot_context_read’ at drivers/platform/chrome/cros_ec_vbc.c:30:8: > > ./include/linux/slab.h:580:24: note: at offset 20 into object of size 36 allocated by ‘kmalloc_trace’ > > 580 | return kmalloc_trace( > > | ^~~~~~~~~~~~~~ > > 581 | kmalloc_caches[kmalloc_type(flags)][index], > > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > 582 | flags, size); > > | ~~~~~~~~~~~~ > > Please trim the commit message a bit and try to wrap at 75 columns as > [1] suggested. > > [1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format For outputs from tools like this, going over 75 columns is fine, no need to ever line-wrap stuff like this, that would just make it unreadable. thanks, greg k-h