Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7759974rwr; Wed, 10 May 2023 12:13:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Aa+8nqCw1eMYTZdh4mym5NzR6ZTyoSZsukWeEHedqbMwAbiUjy063AqbCP+dhYxnfGaoQ X-Received: by 2002:a17:903:338e:b0:1a9:4601:a7c9 with SMTP id kb14-20020a170903338e00b001a94601a7c9mr17017655plb.12.1683745991559; Wed, 10 May 2023 12:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683745991; cv=none; d=google.com; s=arc-20160816; b=rrGK7ZcwuwgObxGduCPkFWjvUUoaRHVMIyZZ4+5pdV5flcGRw6HUh8G6s8d3bub+VR CCsVb1voheCWQ/pohByj3/yOVBzoXlwKxtRklnnZVZ2uPy60IqO145vLcipM6jsr2Hej g4qGLV8rTne6ZUXmBmdYJfx4HaqaNnxq0EXCZ7L/roUmdAo6beqP+bcyS+paJB7pMPSU DJW04phjaOuueco+aHznfYgy6DWhKZv5hBnI2NFv+L9nlPkEox/U6ejcrDfpxIPRHY4z GCMeZLycIwh+ClrZKSnOMtQ4iDuuxboJhfTqf7VYVMr6/vSuWP83ajR0JPvwidOxITmL l9JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=lxguqY4S16tZeT7RMekpOI21FADH1yjNY8YIqvTqbyM=; b=zhZvMQ0Je44rSJ7pGOSZw3bstH8Zy1CZvKGaC5HHpwSltawYQtGaRDHx1gQPFoAv63 QpQUsFk40LkWbTntefnvUA0wqrYEJQi00VXco6zwVseMsgADBxdXCQQbqe0IzB0G22TM ZUreJWTwC+CQyOi8F90qSf1kN6jUz18zIv6NwepwOzcnOWYqywmilvncc8Ad/whu+Xey Yhdf+1Z2G4iYkmO8HVpYu5TRjEF/l1t+U3UYdSA9Z/vKuW8T2axHMj4yyzp+W4oa+bMD g1XLVESyohbPfkL9YyQtJ8p1kPQ66YWfE2X8g3yARV04zpZTjdGfFN1kkE+AX6/Ztgl0 RoSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=I2n2SnX8; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15-20020a170902b08f00b0019ad22c40c7si4580428plr.132.2023.05.10.12.12.56; Wed, 10 May 2023 12:13:11 -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=@gmail.com header.s=20221208 header.b=I2n2SnX8; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235708AbjEJTC2 (ORCPT + 99 others); Wed, 10 May 2023 15:02:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbjEJTC1 (ORCPT ); Wed, 10 May 2023 15:02:27 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E89610D3; Wed, 10 May 2023 12:02:26 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f1411e8111so8486034e87.1; Wed, 10 May 2023 12:02:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683745344; x=1686337344; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lxguqY4S16tZeT7RMekpOI21FADH1yjNY8YIqvTqbyM=; b=I2n2SnX88DnF4aRXyA+hq/WiN3F206P2YysVnnTiH6QeMcBJkA3U0mSdX78MJeJVOX j6ITofZCED7dL0K8Uwosf1SBD1yyMtcEDg/k/gyQP30CbIF1BvqbFIEZU8BuqMR5dk+q wksOYuPX6cvkaNL1WhjSkssfCPC3MhPCz30HVsAUNhNPLerNnAM4IXUtgkEhWs8/PB1x n6t39L7ovFSWzU3gXm1WEjEON8anYIUG12cRY0U1XX4T9fvDnUHtRPAK2CKc5CVw6g/M rSc69qMFh5aSkZBM5bFrOOxTgoxAusyLzhIKInkcTc8rI+Ngd6zIiNTYVR64Qs3/Z4t7 wYrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683745344; x=1686337344; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lxguqY4S16tZeT7RMekpOI21FADH1yjNY8YIqvTqbyM=; b=XVFEEf8lxTHWXruuPdFHCz1h93DspC0bu8za4zQghZhkLq7u6a7AjnLeQCLxN1xN/h BdOExv5w0NtpJ4B14aNIcXnA/FAMcxLUc0O/MAlximWfL6rkJHH6pSW3zuMpvy26DoHB Tyb8aLwJ9F+wZcgiMrYDm2g4Y5ftlz2OTtAqo5WzM9YEKTok/Px29zWBZHnjx4AcH9w0 yDuUsOJLwFB4f3W6jU25XTrZ9gkjXEGZSXN8+qsjpb++uJ8y5ShG4nk84RHfB7rk9tfo MjUdhGnz6IMKhoqzesTIOHWMsN84qH4lw3pxqeA1Ggi4QCXIcJTzSOHYxLJ4UM23jdbx bQ7w== X-Gm-Message-State: AC+VfDxwuDbTUpWnpH3J3SaffkFKBsVPZ/PIL3mHcCHPe3is7sYPWxsz C8QJAP1gBv7EQwtGV28VSpmR/ah0HnXryKL1jSM= X-Received: by 2002:a2e:b282:0:b0:2a7:75aa:40c with SMTP id 2-20020a2eb282000000b002a775aa040cmr2428524ljx.10.1683745344533; Wed, 10 May 2023 12:02:24 -0700 (PDT) MIME-Version: 1.0 References: <20230505220043.39036-1-jorge.lopez2@hp.com> <20230505220043.39036-5-jorge.lopez2@hp.com> <51607d2d-2d74-7dd4-e266-cf3ec0235e7a@linux.intel.com> In-Reply-To: From: Jorge Lopez Date: Wed, 10 May 2023 14:01:55 -0500 Message-ID: Subject: Re: [PATCH v12 04/13] HP BIOSCFG driver - int-attributes To: =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= Cc: hdegoede@redhat.com, platform-driver-x86@vger.kernel.org, LKML , thomas@t-8ch.de Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Tue, May 9, 2023 at 5:24=E2=80=AFAM Ilpo J=C3=A4rvinen wrote: > > On Mon, 8 May 2023, Jorge Lopez wrote: > > > On Mon, May 8, 2023 at 9:45=E2=80=AFAM Ilpo J=C3=A4rvinen > > wrote: > > > > > > On Fri, 5 May 2023, Jorge Lopez wrote: > > > > > > > HP BIOS Configuration driver purpose is to provide a driver support= ing > > > > the latest sysfs class firmware attributes framework allowing the u= ser > > > > to change BIOS settings and security solutions on HP Inc.=E2=80=99s= commercial > > > > notebooks. > > > > > > > > Many features of HP Commercial notebooks can be managed using Windo= ws > > > > Management Instrumentation (WMI). WMI is an implementation of Web-B= ased > > > > Enterprise Management (WBEM) that provides a standards-based interf= ace > > > > for changing and monitoring system settings. HP BIOSCFG driver prov= ides > > > > a native Linux solution and the exposed features facilitates the > > > > migration to Linux environments. > > > > > > > > The Linux security features to be provided in hp-bioscfg driver ena= bles > > > > managing the BIOS settings and security solutions via sysfs, a virt= ual > > > > filesystem that can be used by user-mode applications. The new > > > > documentation cover HP-specific firmware sysfs attributes such Secu= re > > > > Platform Management and Sure Start. Each section provides security > > > > feature description and identifies sysfs directories and files expo= sed > > > > by the driver. > > > > > > > > Many HP Commercial notebooks include a feature called Secure Platfo= rm > > > > Management (SPM), which replaces older password-based BIOS settings > > > > management with public key cryptography. PC secure product manageme= nt > > > > begins when a target system is provisioned with cryptographic keys > > > > that are used to ensure the integrity of communications between sys= tem > > > > management utilities and the BIOS. > > > > > > > > HP Commercial notebooks have several BIOS settings that control its > > > > behaviour and capabilities, many of which are related to security. > > > > To prevent unauthorized changes to these settings, the system can > > > > be configured to use a cryptographic signature-based authorization > > > > string that the BIOS will use to verify authorization to modify the > > > > setting. > > > > > > > > Linux Security components are under development and not published y= et. > > > > The only linux component is the driver (hp bioscfg) at this time. > > > > Other published security components are under Windows. > > > > > > > > Signed-off-by: Jorge Lopez > > > > > > > > --- > > > > Based on the latest platform-drivers-x86.git/for-next > > > > --- > > > > > +int alloc_integer_data(void) > > > > +{ > > > > + bioscfg_drv.integer_instances_count =3D get_instance_count(HP= _WMI_BIOS_INTEGER_GUID); > > > > + bioscfg_drv.integer_data =3D kcalloc(bioscfg_drv.integer_inst= ances_count, > > > > + sizeof(struct integer_data= ), GFP_KERNEL); > > > > > > It would be better to use sizeof(*...) format. > > > > I cannot use sizeof(*...) at this time, because it is allocating > > bioscfg_drv.integer_instances_count number of integer_data > > structures. > > Isn't bioscfg_drv.integer_data is a pointer to a single struct > integer_data? Why cannot you do sizeof(*bioscfg_drv.integer_data)?? It is > perfectly legal C construct for getting the size of the struct the > pointer points to. > > You are correct. I found the problem in the code during my testing. I will update similar code across all files. > -- > i.