From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1keEZB-0001eO-S3 for mharc-grub-devel@gnu.org; Sun, 15 Nov 2020 04:43:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keEZA-0001d3-8I for grub-devel@gnu.org; Sun, 15 Nov 2020 04:43:24 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:40753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keEZ8-0001oI-Hm for grub-devel@gnu.org; Sun, 15 Nov 2020 04:43:23 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D34DF5C010B; Sun, 15 Nov 2020 04:43:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 15 Nov 2020 04:43:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=wyWFWuObDDSMGMUN3nsLumg1wyq DL2IgT1il873RJ+E=; b=BLjX1fLrGBZ1m5oHxW1yIGVF8suLVK+1mTeYJfdd2jh eLX7kT6hWpNLskHsFzlMkrjA7p+5YLzLCCe1TNz8ahPJRq3qePLSOZvkyHH7AtfU p9yxgluz7NKj2L3Of9byJSTq5CqlrQa2waM6h3r9Ht13LsIzB7wOvp7Tc61B1m4u tq7xzlenOv/vQn8P4XvrZdY5SOYQtFAAqC8TrljVOhAZTo6Fq9UUV91fGKGJ3jvL QjpF8vaFPDLqI7WExZG9Tjt5fLtN9fbTgFRwARVNY3YbTTFoDZxzshnLcIbLK3K6 BV9rWTyXri4RFRdRGBovHc6ZlpUp/Smozx7m4k/PWIg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=wyWFWu ObDDSMGMUN3nsLumg1wyqDL2IgT1il873RJ+E=; b=BGp10NPdyjMPMPZBwRMW+E e82M5RCXNQ9wHhXww63fogoTf8DLurP6voHZJCg6bXwYI5j1bYUeq80aHzdt9Yto WLlu3Ugdtx7Mms3bl7jsfpGp0nOfEc+Zb4rFytWCyQ1q0EFSSLtPUgeFTa23yK27 kmv82K+9/76hFK5n/qZVJbSdYNHHvUzBXJNxLcCTvsuGWBvpU5jORSuI2DghZ1Ln 6KsbmB070cJy4+wgLvt1M+ULXuUppUF+fteEgHCsfTXrGOmrAsUE/eH9DRI4jsyB XATK1qBtz5E+IV4/gRb8BZhmeLIDk+Ufuns1rpmyy8ZubVQ7kvI7XXDgiCqGSbUg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvledgtdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeehgefhtdefueffheekgfffudelffejtdfhvdejkedthfehvdelgfetgfdvtedthfen ucfkphepjeekrdehgedrvddurddvtdeinecuvehluhhsthgvrhfuihiivgepudenucfrrg hrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Received: from vm-mail.pks.im (dynamic-078-054-021-206.78.54.pool.telefonica.de [78.54.21.206]) by mail.messagingengine.com (Postfix) with ESMTPA id 289493064AAA; Sun, 15 Nov 2020 04:43:20 -0500 (EST) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id 24ee321d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 15 Nov 2020 09:43:19 +0000 (UTC) Date: Sun, 15 Nov 2020 10:43:17 +0100 From: Patrick Steinhardt To: Glenn Washburn Cc: grub-devel@gnu.org, Daniel Kiper Subject: Re: [PATCH v4 05/15] luks2: Use correct index variable when looping in luks2_get_keyslot. Message-ID: References: <4839ead9b5c7d1b9dfc15bfa27db2852e39d6739.1604723348.git.development@efficientek.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TZMNuGlqH6qpRxyV" Content-Disposition: inline In-Reply-To: <4839ead9b5c7d1b9dfc15bfa27db2852e39d6739.1604723348.git.development@efficientek.com> Received-SPF: pass client-ip=66.111.4.27; envelope-from=ps@pks.im; helo=out3-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/15 04:37:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2020 09:43:24 -0000 --TZMNuGlqH6qpRxyV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 06, 2020 at 10:44:25PM -0600, Glenn Washburn wrote: > The loop variable j should be used to index the digests and segments json > array, instead of the variable i, which is the keyslot index. >=20 > Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt > --- > grub-core/disk/luks2.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c > index d963255d4..be42deb14 100644 > --- a/grub-core/disk/luks2.c > +++ b/grub-core/disk/luks2.c > @@ -275,10 +275,10 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k, grub_lu= ks2_digest_t *d, grub_luks2_s > return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not get digests"); > for (j =3D 0; j < size; j++) > { > - if (grub_json_getchild (&digest, &digests, i) || > + if (grub_json_getchild (&digest, &digests, j) || > grub_json_getchild (&digest, &digest, 0) || > luks2_parse_digest (d, &digest)) > - return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse digest %"PRI= uGRUB_SIZE, i); > + return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse digest %"PRI= uGRUB_SIZE, j); > =20 > if ((d->keyslots & (1 << idx))) > break; > @@ -292,11 +292,11 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k, grub_lu= ks2_digest_t *d, grub_luks2_s > return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not get segments"); > for (j =3D 0; j < size; j++) > { > - if (grub_json_getchild (&segment, &segments, i) || > + if (grub_json_getchild (&segment, &segments, j) || > grub_json_getuint64 (&idx, &segment, NULL) || > grub_json_getchild (&segment, &segment, 0) || > luks2_parse_segment (s, &segment)) > - return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse segment %"PR= IuGRUB_SIZE, i); > + return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse segment %"PR= IuGRUB_SIZE, j); > =20 > if ((d->segments & (1 << idx))) > break; > --=20 > 2.27.0 >=20 --TZMNuGlqH6qpRxyV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAl+w+DQACgkQVbJhu7ck PpQcvxAAivD6xgQWPw+hzDlCcgR+DW1NeRUuW8bmWuOiaGBMRtCHns6jC98DITVB p+J0rUKfhbF/oSqBJETwCR5b2ric8EUit5+ZJlrYNCBmJAaRsHJNCOmA4gFvDC5A mFd+QCjzVoX/U9c8moXvLFmfCRdnF4lbOhnvdXuebzswmIaC/QFWbs1VFBKK0VmY dvRG/1TWZyL4Fpky/1BfjXmES0L0rg6c3eWkaF+xZxM6FQ6WVF1YL72V3dxMTPEP aOcikUPkCvA3OC8wRDlLVHjcdlbl8uVwbi6mEUiblrw3+Jzbfw04TN/a78135x3k OXBDoTLyqIuyDSN5byRMRkDBp2t6pgCDxqcZ0bu7e3EqJKPhZlgiRAeEG9cDqAK9 JglqCg0Kws4jVYNoi70Ct16UPoUUgG3HJgk8pngw4KDDCd5oKzM8jrpr4FKgNckY tTO2CogzTcofhzGta5BNKMlTtbphEGzsgE7vgOgWLktySSuTXETVgW49JtGGuBFO LJRso47/w8/9fal1GlJ9OwPfjsF4iVVgYwXUkcSOA0bwiiUO48yPee1Cg3AuItAu ky0QjslaEUKRIiKabaZ5iMN8Q4OhzQbMnmLF3QMldmnvbhv28iazRRozZqschDtt WVkLvUV0whJjfiMKx1oMs1PmDtw+5hgPCVw9qCdnZQbUI2Hchaw= =hppa -----END PGP SIGNATURE----- --TZMNuGlqH6qpRxyV--