Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp816324lqb; Fri, 24 May 2024 14:28:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVgov3JBXH9Mi2SRmPNwJldrjoFvFYn5gPI9nSPVBS8C5bJkWTrmmwzEqfqh8Ihb91J4g++5iqNinbc6HvNvxcGCJMQrFBkaWPT6fyc3g== X-Google-Smtp-Source: AGHT+IEM84UdJn/9xq+3exGFo9Q2WHLshRbO/HNSANHXfYN74WlkVPUdEIy1oFPHmp2bW7iAohPX X-Received: by 2002:a50:ab47:0:b0:572:2efe:4d14 with SMTP id 4fb4d7f45d1cf-57850c60807mr2955211a12.10.1716586084474; Fri, 24 May 2024 14:28:04 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-578524d5145si1171792a12.691.2024.05.24.14.28.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 14:28:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-189148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189148-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2BA5B1F21B43 for ; Fri, 24 May 2024 21:28:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DEC1785C4E; Fri, 24 May 2024 21:27:46 +0000 (UTC) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9B7883CBD for ; Fri, 24 May 2024 21:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.201.40.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716586066; cv=none; b=Qj+iXiMS//1jmt3aC8XcNPyOq18TEZoq3yFv/KLaevMvUxB4v+mD/epXm0g4B6f0/UbdsOtNrfeL8qEj+HMutPUozsnJMfReT1P+HgXi364tcTO0vNZOUptdDorVf29/MrTAaW4e4VP9H64SMufkQ3+gDGZZukHvxAIZ7gkOzqk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716586066; c=relaxed/simple; bh=6LUbgEU1sHvRL09NLMAPira3jisNG7ZtwY9v2d7Go5s=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: MIME-Version:Content-Type; b=cbwiuNXv9NX5R5Z+pfGoFNiJJi/XsHu3jBhpG7ElDbTMumnrFZ5lWBThzuzytcd536HWhlxFugsw9XUugV6C23/1C6NPTddCahJEracSWMv861MVJP1xUe4zrXv+nXB5gf6t9qHQR6CGKp1lL9V4HYZgEAi70EAgJhfUXNfMhKw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nod.at; spf=fail smtp.mailfrom=nod.at; arc=none smtp.client-ip=195.201.40.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nod.at Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 497716195FCA; Fri, 24 May 2024 23:27:43 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id FgmitsyXq52a; Fri, 24 May 2024 23:27:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id C0C306195FCC; Fri, 24 May 2024 23:27:42 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WOanlW2rmycA; Fri, 24 May 2024 23:27:42 +0200 (CEST) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 9BDD86195FCA; Fri, 24 May 2024 23:27:42 +0200 (CEST) Date: Fri, 24 May 2024 23:27:42 +0200 (CEST) From: Richard Weinberger To: Jarkko Sakkinen Cc: kernel test robot , david , oe-kbuild-all , linux-kernel , david oberhollenzer Message-ID: <39518719.144820.1716586062550.JavaMail.zimbra@nod.at> In-Reply-To: References: <202405240610.fj53EK0q-lkp@intel.com> <1855855000.144805.1716584815663.JavaMail.zimbra@nod.at> Subject: Re: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base types) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF97 (Linux)/8.8.12_GA_3809) Thread-Topic: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base types) Thread-Index: YxKdVb/v6foZyOVf4L0HtOwHX9OJ0Q== ----- Urspr=C3=BCngliche Mail ----- > Von: "Jarkko Sakkinen" > An: "richard" , "kernel test robot" > CC: "david" , "oe-kbuild-all" , "linux-kernel" > , "david oberhollenzer" > Gesendet: Freitag, 24. Mai 2024 23:24:30 > Betreff: Re: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: spa= rse: incorrect type in assignment (different > base types) > On Sat May 25, 2024 at 12:06 AM EEST, Richard Weinberger wrote: >> >| Reported-by: kernel test robot >> >| Closes: >> >| https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intel= com/ >> >=20 >> > sparse warnings: (new ones prefixed by >>) >> >>> security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: inc= orrect type >> >>> in assignment (different base types) @@ expected restricted __le= 32 >> >>> [usertype] payload_len @@ got unsigned int @@ >> > security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: expecte= d restricted >> > __le32 [usertype] payload_len >> > security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: got uns= igned int >> >=20 >> > vim +206 security/keys/trusted-keys/trusted_dcp.c >> >=20 >> > 179 >> > 180=09static int trusted_dcp_seal(struct trusted_key_payload *p, cha= r *datablob) >> > 181=09{ >> > 182=09=09struct dcp_blob_fmt *b =3D (struct dcp_blob_fmt *)p->blob; >> > 183=09=09int blen, ret; >> > 184 >> > 185=09=09blen =3D calc_blob_len(p->key_len); >> > 186=09=09if (blen > MAX_BLOB_SIZE) >> > 187=09=09=09return -E2BIG; >> > 188 >> > 189=09=09b->fmt_version =3D DCP_BLOB_VERSION; >> > 190=09=09get_random_bytes(b->nonce, AES_KEYSIZE_128); >> > 191=09=09get_random_bytes(b->blob_key, AES_KEYSIZE_128); >> > 192 >> > 193=09=09ret =3D do_aead_crypto(p->key, b->payload, p->key_len, b->b= lob_key, >> > 194=09=09=09=09 b->nonce, true); >> > 195=09=09if (ret) { >> > 196=09=09=09pr_err("Unable to encrypt blob payload: %i\n", ret); >> > 197=09=09=09return ret; >> > 198=09=09} >> > 199 >> > 200=09=09ret =3D encrypt_blob_key(b->blob_key); >> > 201=09=09if (ret) { >> > 202=09=09=09pr_err("Unable to encrypt blob key: %i\n", ret); >> > 203=09=09=09return ret; >> > 204=09=09} >> > 205 >> > > 206=09=09b->payload_len =3D get_unaligned_le32(&p->key_len); >> >> I think this should be a put_unaligned_le32(p->key_len, &b->payload_len)= . >=20 > Please send then fix, reasoning of that, and finally: Sure. Let me first talk to David and give it a test... Thanks, //richard