From: Alison Schofield <alison.schofield@intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: linux-cxl@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] cxl: Fix warning from emitting resoruce_size_t as long long int on 32bit systems
Date: Fri, 28 Feb 2025 12:31:07 -0800 [thread overview]
Message-ID: <Z8IdC2dbdWcqlg4O@aschofie-mobl2.lan> (raw)
In-Reply-To: <20250228194402.3745766-1-dave.jiang@intel.com>
On Fri, Feb 28, 2025 at 12:44:02PM -0700, Dave Jiang wrote:
> Reported by kernel test bot from an ARM build:
> drivers/cxl/core/region.c:3263:26: warning: format '%lld' expects argument of type 'long long int', but argument 3 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
>
> On a 32bit system, resoruce_size_t is defined as 32bit long vs on a 64bit
'resource' here and in commit msg.
> system it is defined as 64bit long. Define the variables as u64 instead to
> make the size same across all archs.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202503010252.mIDhZ5kY-lkp@intel.com/
> Fixes: 0ec9849b6333 ("acpi/hmat / cxl: Add extended linear cache support for CXL")
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/cxl/core/region.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index a83301f24fa2..958c15842b1e 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -3235,14 +3235,15 @@ static int cxl_extended_linear_cache_resize(struct cxl_region *cxlr,
> struct cxl_root_decoder *cxlrd = to_cxl_root_decoder(cxlr->dev.parent);
> struct cxl_region_params *p = &cxlr->params;
> int nid = phys_to_target_node(res->start);
> - resource_size_t size, cache_size, start;
> + u64 size, cache_size, start;
> int rc;
>
> size = resource_size(res);
> if (!size)
> return -EINVAL;
>
> - rc = cxl_acpi_get_extended_linear_cache_size(res, nid, &cache_size);
> + rc = cxl_acpi_get_extended_linear_cache_size(res, nid,
> + (resource_size_t *)&cache_size);
> if (rc)
> return rc;
Ah...I was thinking this fixup would be either a %pa format or (u64)cast on
cache_size in the dev_warns, but this works too.
Do we also need to do this to avoid a complaint assigning to cxl_region_params:
- p->cache_size = cache_size;
+ p->cache_size = (resource_size_t)cache_size;
>
> --
> 2.48.1
>
>
next prev parent reply other threads:[~2025-02-28 20:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 19:44 [PATCH] cxl: Fix warning from emitting resoruce_size_t as long long int on 32bit systems Dave Jiang
2025-02-28 20:31 ` Alison Schofield [this message]
2025-02-28 20:33 ` Dave Jiang
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=Z8IdC2dbdWcqlg4O@aschofie-mobl2.lan \
--to=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=lkp@intel.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