Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572067 > unrolled thread

[PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer

Started by"Tobin C. Harding" <me@tobin.cc>
First post2017-02-02 00:40 +0100
Last post2017-02-02 14:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer "Tobin C. Harding" <me@tobin.cc> - 2017-02-02 00:40 +0100
    Re: [PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-02-02 14:10 +0100

#1572067 — [PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer

From"Tobin C. Harding" <me@tobin.cc>
Date2017-02-02 00:40 +0100
Subject[PATCH 1/4] mm: Fix sparse, use plain integer as NULL pointer
Message-ID<t6cFk-4kV-21@gated-at.bofh.it>
From: Tobin C Harding <me@tobin.cc>

Patch fixes sparse warning: Using plain integer as NULL pointer. Replaces
assignment of 0 to pointer with NULL assignment.

Signed-off-by: Tobin C Harding <me@tobin.cc>
---
 mm/memory.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 6bf2b47..cc5fa12 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2905,7 +2905,7 @@ static int pte_alloc_one_map(struct vm_fault *vmf)
 		atomic_long_inc(&vma->vm_mm->nr_ptes);
 		pmd_populate(vma->vm_mm, vmf->pmd, vmf->prealloc_pte);
 		spin_unlock(vmf->ptl);
-		vmf->prealloc_pte = 0;
+		vmf->prealloc_pte = NULL;
 	} else if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd, vmf->address))) {
 		return VM_FAULT_OOM;
 	}
@@ -2953,7 +2953,7 @@ static void deposit_prealloc_pte(struct vm_fault *vmf)
 	 * count that as nr_ptes.
 	 */
 	atomic_long_inc(&vma->vm_mm->nr_ptes);
-	vmf->prealloc_pte = 0;
+	vmf->prealloc_pte = NULL;
 }
 
 static int do_set_pmd(struct vm_fault *vmf, struct page *page)
@@ -3359,7 +3359,7 @@ static int do_fault(struct vm_fault *vmf)
 	/* preallocated pagetable is unused: free it */
 	if (vmf->prealloc_pte) {
 		pte_free(vma->vm_mm, vmf->prealloc_pte);
-		vmf->prealloc_pte = 0;
+		vmf->prealloc_pte = NULL;
 	}
 	return ret;
 }
-- 
2.7.4

[toc] | [next] | [standalone]


#1572343

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2017-02-02 14:10 +0100
Message-ID<t6pjb-4nr-5@gated-at.bofh.it>
In reply to#1572067
On Thu, Feb 02, 2017 at 10:37:17AM +1100, Tobin C. Harding wrote:
> From: Tobin C Harding <me@tobin.cc>
> 
> Patch fixes sparse warning: Using plain integer as NULL pointer. Replaces
> assignment of 0 to pointer with NULL assignment.
> 
> Signed-off-by: Tobin C Harding <me@tobin.cc>

I wrote this part when ARC had pgtable_t defined as 'unsigned long', so
NULL wasn't an option, but 0 was as it's valid pointer according to spec.

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web