Skip to contentSkip to conversation

xen/privcmd: fix condition in privcmd_close()

PATCH New Dan Carpenter 2 participants 3 messages Nov 5, 2012 – May 15, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/privcmd: fix condition in privcmd_close()

The parenthesis are in the wrong place so the original code is equivalent to:

if (!xen_feature(XENFEAT_writable_descriptor_tables)) { ...

Which obviously was not intended.

drivers/xen/privcmd.c +1 -1
index b9d0898..6011f3b 100644
@@ -495,7 +495,7 @@ static void privcmd_close(struct vm_area_struct *vma)
 	struct page **pages = vma->vm_private_data;
 	int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
 
-	if (!xen_feature(XENFEAT_auto_translated_physmap || !numpgs || !pages))
+	if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages)
 		return;
 
 	xen_unmap_domain_mfn_range(vma, numpgs, pages);
#1 lore raw

PATCH 1/1 xen/privcmd: fix condition in privcmd_close()

The parenthesis are in the wrong place so the original code is equivalent to:

	if (!xen_feature(0x1)) { ...

Or:
if (!xen_feature(XENFEAT_writable_descriptor_tables)) { ...

Which obviously was not intended.

---
I sent this last November but it was never merged.

drivers/xen/privcmd.c +1 -1
index ca2b00e..2cfc24d 100644
@@ -504,7 +504,7 @@ static void privcmd_close(struct vm_area_struct *vma)
 	struct page **pages = vma->vm_private_data;
 	int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
 
-	if (!xen_feature(XENFEAT_auto_translated_physmap || !numpgs || !pages))
+	if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages)
 		return;
 
 	xen_unmap_domain_mfn_range(vma, numpgs, pages);
#2 lore raw
Quoted 4 lines · Dan Carpenter

The parenthesis are in the wrong place so the original code is equivalent to:

	if (!xen_feature(0x1)) { ...
Quoted 8 lines

Or:
if (!xen_feature(XENFEAT_writable_descriptor_tables)) { ...

Which obviously was not intended.

---
I sent this last November but it was never merged.

Ah, it was, but in a different branch (stable/pvh.v8). Let me stick it on branch for Linus.