From: Matthew Auld <matthew.auld@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
igt-dev@lists.freedesktop.org
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: Re: [PATCH i-g-t] lib/igt_aux: Protect expressions from premature casting in aux macros
Date: Wed, 4 Feb 2026 14:39:24 +0000 [thread overview]
Message-ID: <82a83ea4-8d14-4f98-ae6e-6741cdae608d@intel.com> (raw)
In-Reply-To: <20260204135500.311469-2-zbigniew.kempczynski@intel.com>
On 04/02/2026 13:55, Zbigniew Kempczyński wrote:
> Missing brackets around expressions might cause undesired behavior
> during type casting, for example:
>
> objs = 4096;
> objs = min_t(int, objs, vram_size() / SZ_4K)
>
> If vram_size() is 0x80000000 casting to int gives negative number,
> so min_t also will be negative even if it wasn't our intention.
>
> Add round brackets to ensure casting refers to whole expression.
>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
next prev parent reply other threads:[~2026-02-04 14:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 13:55 [PATCH i-g-t] lib/igt_aux: Protect expressions from premature casting in aux macros Zbigniew Kempczyński
2026-02-04 14:31 ` Kamil Konieczny
2026-02-04 14:39 ` Matthew Auld [this message]
2026-02-04 14:45 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-02-04 15:09 ` ✓ i915.CI.BAT: " Patchwork
2026-02-04 23:55 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-02-05 11:52 ` Zbigniew Kempczyński
2026-02-05 2:50 ` ✗ i915.CI.Full: " Patchwork
2026-02-05 11:53 ` Zbigniew Kempczyński
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=82a83ea4-8d14-4f98-ae6e-6741cdae608d@intel.com \
--to=matthew.auld@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=zbigniew.kempczynski@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