Skip to contentSkip to conversation

Patch "acpi, nfit, libnvdimm: fix interleave set cookie calculation (64-bit comparison)" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Apr 18, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

acpi, nfit, libnvdimm: fix interleave set cookie calculation (64-bit comparison)

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
acpi-nfit-libnvdimm-fix-interleave-set-cookie-calculation-64-bit-comparison.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From b03b99a329a14b7302f37c3ea6da3848db41c8c5 Mon Sep 17 00:00:00 2001

From: Dan Williams <[email protected]>
Date: Mon, 27 Mar 2017 21:53:38 -0700
Subject: acpi, nfit, libnvdimm: fix interleave set cookie calculation (64-bit comparison)

From: Dan Williams <[email protected]>

commit b03b99a329a14b7302f37c3ea6da3848db41c8c5 upstream.

While reviewing the -stable patch for commit 86ef58a4e35e "nfit,
libnvdimm: fix interleave set cookie calculation" Ben noted:

"This is returning an int, thus it's effectively doing a 32-bit
comparison and not the 64-bit comparison you say is needed."

Update the compare operation to be immune to this integer demotion problem.

Cc Nicholas Moulin <[email protected]>
Fixes 86ef58a4e35e ("nfit, libnvdimm: fix interleave set cookie calculation")
---
 drivers/acpi/nfit/core.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/acpi/nfit/core.c +5 -1
@@ -1617,7 +1617,11 @@ static int cmp_map(const void *m0, const
 	const struct nfit_set_info_map *map0 = m0;
 	const struct nfit_set_info_map *map1 = m1;
 
-	return map0->region_offset - map1->region_offset;
+	if (map0->region_offset < map1->region_offset)
+		return -1;
+	else if (map0->region_offset > map1->region_offset)
+		return 1;
+	return 0;
 }
 
 /* Retrieve the nth entry referencing this spa */

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/acpi-nfit-libnvdimm-fix-interleave-set-cookie-calculation-64-bit-comparison.patch queue-4.9/libnvdimm-fix-blk-free-space-accounting.patch queue-4.9/x86-pmem-fix-broken-__copy_user_nocache-cache-bypass-assumptions.patch queue-4.9/libnvdimm-fix-reconfig_mutex-mmap_sem-and-jbd2_handle-lockdep-splat.patch