Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752739AbdCSRLI (ORCPT ); Sun, 19 Mar 2017 13:11:08 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:56149 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752372AbdCSRK2 (ORCPT ); Sun, 19 Mar 2017 13:10:28 -0400 Message-ID: <1489941516.2852.75.camel@decadent.org.uk> Subject: Re: [PATCH 4.4 33/35] nfit, libnvdimm: fix interleave set cookie calculation From: Ben Hutchings To: Dan Williams Cc: stable@vger.kernel.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Nicholas Moulin Date: Sun, 19 Mar 2017 16:38:36 +0000 In-Reply-To: <20170316142908.881234387@linuxfoundation.org> References: <20170316142906.685052998@linuxfoundation.org> <20170316142908.881234387@linuxfoundation.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-Jp+VcgSsDXJQLzZPN5Fn" X-Mailer: Evolution 3.22.5-1 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2694 Lines: 75 --=-Jp+VcgSsDXJQLzZPN5Fn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2017-03-16 at 23:29 +0900, Greg Kroah-Hartman wrote: > 4.4-stable review patch.=C2=A0=C2=A0If anyone has any objections, please = let me know. >=20 > ------------------ >=20 > From: Dan Williams >=20 > commit 86ef58a4e35e8fa66afb5898cf6dec6a3bb29f67 upstream. >=20 > The interleave-set cookie is a sum that sanity checks the composition of > an interleave set has not changed from when the namespace was initially > created.=C2=A0=C2=A0The checksum is calculated by sorting the DIMMs by th= eir > location in the interleave-set. The comparison for the sort must be > 64-bit wide, not byte-by-byte as performed by memcmp() in the broken > case. [...] > --- a/drivers/acpi/nfit.c > +++ b/drivers/acpi/nfit.c [...] > +static int cmp_map(const void *m0, const void *m1) > +{ > + const struct nfit_set_info_map *map0 =3D m0; > + const struct nfit_set_info_map *map1 =3D m1; > + > + return map0->region_offset - map1->region_offset; > +} [...] This is returning an int, thus it's effectively doing a 32-bit comparison and not the 64-bit comparison you say is needed. I think this function needs to do something like: return (map0->region_offset < map1->region_offset) ? -1 : (map0->region_offset =3D=3D map1->region_offset) ? 0 : 1; Ben. --=20 Ben Hutchings Power corrupts.=C2=A0=C2=A0Absolute power is kind of neat. =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0- John Lehman, Secretary of the US Navy 1981-1987 --=-Jp+VcgSsDXJQLzZPN5Fn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEErCspvTSmr92z9o8157/I7JWGEQkFAljOtAwACgkQ57/I7JWG EQkLMxAApe5KF9Ef/y7V1j/imJDsBtvwFnPfOFagXhuy4zM9UF0HL3FMOyCvt6TL CuInpNMWheJ8EREQ1VLiWUdZTo3wTxaBg1S+AiNRCkrdQdFZPFUvG1ojE5RgDj4y UR83o39R0nf5b6aPOzoJsX455D1Af2yaP6w4i1ZE+SgvD0o8yrUT8Io5lK3DhZ+G pV3dyPtiTZg5Hf9axnDBT/o/lAU5jKk2hMSzKqEuzLD4ApW+wxGtBq/Wd0ou5MaZ CfeFzAmzFPy1G6Rdfd3GsDFQcTTti/sET1u0Td684SdR0JiELtFNMrVH1r0NLEbZ czLsqX3uSRtvxAzJw/Tw81i0IO/4DIIAZMqYHg3pUqzRFAgf8CjUI/zVZaQ1H+mF +BUhi9PDshtwrn2MkfWqr90aSvWobSuevE/OOHSuhFyR+XfG5sP8ZPW3R+qtKskn 22EnUGj9Ahyv32v++NCv6KVdn1Ibipu4UCPSKKNEGPZTwyLdqriqUdAWCGgS361J 9tAZaHqBQdNIAOoPrvi59uaxP93N1pq6mCXY/gNluyVtPU9rRjwQHu1OkIidujXm rr9OYZfvnSd655cm6FFn1n6pchb4fO/GLMYfH8A1Wf48MQnaZJXme50vET/YZGnI +SNH5kD0T1rgTGaiy5MlUqj0PYSaQvHuouMWyU8vsXyxamvFjZY= =iORF -----END PGP SIGNATURE----- --=-Jp+VcgSsDXJQLzZPN5Fn--