Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5377387rwb; Wed, 7 Sep 2022 01:41:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR5wwyr9RO/fXRXVIT40tqBx2JdbXm/hJujRCmQwPNp+uLn55z21+fLJR+9dp/pVIVSOEcPo X-Received: by 2002:aa7:da86:0:b0:44e:91c8:eb4f with SMTP id q6-20020aa7da86000000b0044e91c8eb4fmr2299382eds.252.1662540102632; Wed, 07 Sep 2022 01:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662540102; cv=none; d=google.com; s=arc-20160816; b=ls7c0YQlU32E22FgGL31Ivt+aOWm5RzMmDVDcKC/Hgv3LzTOfJib256GVmKHQM1aDl ND9DT5cGHVzh+FANWV6Yy1uCSPXPLCbsJchwgAf0LGrhG3jExMpcltc8M6vh6q8xKi60 k5aWzEkB0pVfiXwxSiQNy3gY0eKdoinurFPXhyGIg6DRKgK2IynHVJuBxsLMqQg6G1TB gsOC9FUcgJPO9YptJ7P2wwalW/zC755/48Rw1xocu7Cx6nBQOB2LwujzXyQUlK3cIRqk 8XlpQDFB+1e0We02U84flcUAh3i24TORomPaGA+WDqrSXj1/PUsfN1XRePVax6A9UVhE E6ew== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:dkim-signature; bh=GpUp6OvQ8i7Mr4bNR7ArwU7puV1iks8tSDio6W89hzQ=; b=Hdw5x6BvZVEKJlrYo0c3ZKnq5dkAjPB42qD08DykFq30Jb5ak6JbCOva3uFgmw0lIa aknZUypd7wtG0udcBIEaxKt2dIxEKPeTf2siDopxduzUhdKqI77wmvuSPIil2Xc2fukf VhmWzWCEHrdQgxoPO/GiDF4Oi5PVhS++P/jJDbMlZnoUr8mhxYSHWcsxSBZogyz0eoab 0vsPhtqwbl6w8AR9Yo1C4kbXBUce9qATyKo3K/gV8twdUxDSBlQs0gXVOliDLbRxmb8i sU0oi6WVXgigmVC7Oe9EKFQhaMwYx3gUm0wGAgcBvw9FAfRt+4hJZZFF68Wua6vRORdr hTBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=z+DrRMxS; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb23-20020a1709077e9700b0073d8a8fedbfsi10662496ejc.386.2022.09.07.01.41.15; Wed, 07 Sep 2022 01:41:42 -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=@suse.de header.s=susede2_rsa header.b=z+DrRMxS; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbiIGH5C (ORCPT + 99 others); Wed, 7 Sep 2022 03:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbiIGH47 (ORCPT ); Wed, 7 Sep 2022 03:56:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E7188F977 for ; Wed, 7 Sep 2022 00:56:58 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E2C7620114; Wed, 7 Sep 2022 07:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662537416; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GpUp6OvQ8i7Mr4bNR7ArwU7puV1iks8tSDio6W89hzQ=; b=z+DrRMxS2yUAdV29d2dJyk+TRFJjQkOGmIySRKN8Xrb9Bnc5Ulo/wMkE88vhmug3dlj9dz /yprAILyLOa1eIPZ5w5oD/SIdTKH84n6pDwnjvY9+WjgJ3Sz/TdnNX1NVsAwXriPBMDBhc /hcFBlZnhsDMmgRMnX/60jWji971IUs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662537416; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GpUp6OvQ8i7Mr4bNR7ArwU7puV1iks8tSDio6W89hzQ=; b=WpubPanU4Wqy7dLBVQp1HpmhkdroiWwLSVDMZzonPwgg7/aO5CIYBvmHHDeTKMF9f6NfJp Zng1TZAhyyvxs+Dg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B7F5213A66; Wed, 7 Sep 2022 07:56:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8sUGKshOGGMFCAAAMHmgww (envelope-from ); Wed, 07 Sep 2022 07:56:56 +0000 Date: Wed, 7 Sep 2022 09:56:54 +0200 From: Jean Delvare To: Linus Torvalds Cc: LKML , Andy Shevchenko Subject: Re: [GIT PULL] dmi update for v5.19 Message-ID: <20220907095654.4b1ea5b0@endymion.delvare> In-Reply-To: References: <20220822141930.5f43b5e7@endymion.delvare> Organization: SUSE Linux X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Hi Linus, On Wed, 24 Aug 2022 10:31:35 -0700, Linus Torvalds wrote: > On Mon, Aug 22, 2022 at 5:19 AM Jean Delvare wrote: > > > > Andy Shevchenko (1): > > firmware: dmi: Use the proper accessor for the version field > > I pulled this, but I kind of question it. > > This replaces a single 32-bit memory access (and an optimized byte > swap) and a mask operation with three load-byte-and-shift operations. > > It's not clear that the new code is better. For reference, I had the same objection originally, but Andy convinced me that code clarity was more important than a minor one-time optimization. The whole discussion can be read here: https://lore.kernel.org/all/YuVUdOUl7zwE0QsV@smile.fi.intel.com/T/#mf41d04beeb1d4fddadf77248eec8be397f77cdb5 > That said, I can't imagine it matters - but because I looked at it, I > note that the length check seems to be kind of iffy. > > The code checks that the length of the block is < 32 before doing the > checksum on it, but shouldn't it also check for some minimum size? > Otherwise the dmi checksum is kind of pointless, isn't it? > > It will access a minimum of 24 bytes for that dmi_base thing, so that > would be the most obvious minimum value. But maybe there is some > spec-defined size for that that only covers the header? Thanks for taking the time to look into this. You have a point. It doesn't utterly matter in practice because it's hard to imagine that the checksum would be correct if the size is not. The check for size < 32 is to avoid a walking past the end of the buffer if the entry point is incorrect or corrupted. Every other case of incorrectness or corruption is assumed to be caught by the checksum itself. I suppose that the lack of a check for a minimum size comes from the fact that the legacy DMI entry point did not even have a size field. As a matter of fact, dmidecode does not have a minimum entry point size check either. I can add a minimum entry size check if you want. Some extra robustness can't hurt. Thanks, -- Jean Delvare SUSE L3 Support