public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Andrew Jones <drjones@redhat.com>,
	Jim Mattson <jmattson@google.com>,
	Sean Christopherson <sean.j.christopherson@intel.com>
Subject: [kvm-unit-tests PATCH] lib/alloc_page: Revert to 'unsigned long' for @size params
Date: Mon, 13 Jul 2020 21:20:46 -0700	[thread overview]
Message-ID: <20200714042046.13419-1-sean.j.christopherson@intel.com> (raw)

Revert to using 'unsigned long' instead of 'size_t' for free_pages() and
get_order().  The recent change to size_t for free_pages() breaks i386
with -Werror as the assert_msg() formats expect unsigned longs, whereas
size_t is an 'unsigned int' on i386 (though both longs and ints are 4
bytes).

Message formatting aside, unsigned long is the correct choice given the
current code base as alloc_pages() and free_pages_by_order() explicitly
expect, work on, and/or assert on the size being an unsigned long.

Fixes: 73f4b202beb39 ("lib/alloc_page: change some parameter types")
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Andrew Jones <drjones@redhat.com>
Cc: Jim Mattson <jmattson@google.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 lib/alloc_page.c | 2 +-
 lib/alloc_page.h | 2 +-
 lib/bitops.h     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/alloc_page.c b/lib/alloc_page.c
index fa3c527..aa98981 100644
--- a/lib/alloc_page.c
+++ b/lib/alloc_page.c
@@ -21,7 +21,7 @@ bool page_alloc_initialized(void)
 	return freelist != 0;
 }
 
-void free_pages(void *mem, size_t size)
+void free_pages(void *mem, unsigned long size)
 {
 	void *old_freelist;
 	void *end;
diff --git a/lib/alloc_page.h b/lib/alloc_page.h
index 88540d1..80eded7 100644
--- a/lib/alloc_page.h
+++ b/lib/alloc_page.h
@@ -13,7 +13,7 @@ void page_alloc_ops_enable(void);
 void *alloc_page(void);
 void *alloc_pages(unsigned int order);
 void free_page(void *page);
-void free_pages(void *mem, size_t size);
+void free_pages(void *mem, unsigned long size);
 void free_pages_by_order(void *mem, unsigned int order);
 
 #endif
diff --git a/lib/bitops.h b/lib/bitops.h
index 308aa86..dd015e8 100644
--- a/lib/bitops.h
+++ b/lib/bitops.h
@@ -79,7 +79,7 @@ static inline bool is_power_of_2(unsigned long n)
 	return n && !(n & (n - 1));
 }
 
-static inline unsigned int get_order(size_t size)
+static inline unsigned int get_order(unsigned long size)
 {
 	return size ? fls(size) + !is_power_of_2(size) : 0;
 }
-- 
2.26.0


             reply	other threads:[~2020-07-14  4:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14  4:20 Sean Christopherson [this message]
2020-07-14  6:00 ` [kvm-unit-tests PATCH] lib/alloc_page: Revert to 'unsigned long' for @size params Andrew Jones
2020-07-14  7:12 ` Thomas Huth
2020-07-14 10:02   ` Claudio Imbrenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200714042046.13419-1-sean.j.christopherson@intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=drjones@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox