Module Name:    src
Committed By:   jdolecek
Date:           Tue Apr 14 07:41:05 UTC 2020

Modified Files:
        src/sys/arch/xen/xen: xengnt.c

Log Message:
DRY - use pages for sizeof() for the frame allocations, so it get's allocated
the correct size without repeating the type


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/xen/xen/xengnt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/xengnt.c
diff -u src/sys/arch/xen/xen/xengnt.c:1.34 src/sys/arch/xen/xen/xengnt.c:1.35
--- src/sys/arch/xen/xen/xengnt.c:1.34	Tue Apr 14 07:38:12 2020
+++ src/sys/arch/xen/xen/xengnt.c	Tue Apr 14 07:41:05 2020
@@ -1,4 +1,4 @@
-/*      $NetBSD: xengnt.c,v 1.34 2020/04/14 07:38:12 jdolecek Exp $      */
+/*      $NetBSD: xengnt.c,v 1.35 2020/04/14 07:41:05 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.34 2020/04/14 07:38:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.35 2020/04/14 07:41:05 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -191,7 +191,7 @@ xengnt_map_status(void)
 
 	KASSERT(mutex_owned(&grant_lock));
 
-	sz = gnt_status_frames * sizeof(uint64_t);
+	sz = gnt_status_frames * sizeof(*pages);
 	pages = kmem_alloc(sz, KM_NOSLEEP);
 	if (pages == NULL)
 		return ENOMEM;
@@ -247,7 +247,7 @@ xengnt_more_entries(void)
 	if (gnt_nr_grant_frames == gnt_max_grant_frames)
 		return ENOMEM;
 
-	sz = nframes_new * sizeof(u_long);
+	sz = nframes_new * sizeof(*pages);
 	pages = kmem_alloc(sz, KM_NOSLEEP);
 	if (pages == NULL)
 		return ENOMEM;

Reply via email to