BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yunhui Cui" <cuiyunhui@bytedance.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v6 1/3] riscv: io: avoid null-pointer arithmetic in PIO helpers
Date: Wed, 01 Jul 2026 12:40:29 +0000	[thread overview]
Message-ID: <20260701124030.24B001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701122948.57584-2-cuiyunhui@bytedance.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Incorrect memory barrier used before writing to I/O port in `outsq()`.
--

commit 8166082f73bb766f324d8ad444fbd61adbfe4558
Author: Yunhui Cui <cuiyunhui@bytedance.com>
riscv: io: avoid null-pointer arithmetic in PIO helpers

This commit restricts port I/O string helpers to only be available when
CONFIG_HAS_IOPORT is enabled. This prevents clang from diagnosing null-pointer
arithmetic from the PCI_IOBASE expression when port I/O is not supported.

> diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h
> index 09bb5f57a9d34..92d5f831f3495 100644
> --- a/arch/riscv/include/asm/io.h
> +++ b/arch/riscv/include/asm/io.h
> @@ -116,26 +118,32 @@ __io_writes_outs(writes, u32, l, __io_bw(), __io_aw())

[ ... ]

>  __io_writes_outs(writes, u64, q, __io_bw(), __io_aw())
>  #define writesq(addr, buffer, count) __writesq(addr, buffer, count)
>  
> +#ifdef CONFIG_HAS_IOPORT
>  __io_writes_outs(outs, u64, q, __io_pbr(), __io_paw())

[Severity: High]
This is a pre-existing issue, but does outsq() use the wrong memory barrier?

While outsb(), outsw(), and outsl() correctly pass __io_pbw() as their bfence
parameter, outsq() passes __io_pbr(). Because __io_pbr() expands to a read
barrier instead of a write barrier, could a weakly ordered CPU reorder
earlier memory writes after the I/O port writes?

>  #define outsq(addr, buffer, count) __outsq(PCI_IOBASE + (addr), buffer, count)
>  #endif
> +#endif

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260701122948.57584-1-cuiyunhui@bytedance.com?part=1

  reply	other threads:[~2026-07-01 12:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 12:29 [PATCH v6 0/3] riscv: fix PIO helpers and add optimized percpu ops Yunhui Cui
2026-07-01 12:29 ` [PATCH v6 1/3] riscv: io: avoid null-pointer arithmetic in PIO helpers Yunhui Cui
2026-07-01 12:40   ` sashiko-bot [this message]
2026-07-01 12:29 ` [PATCH v6 2/3] riscv: introduce percpu.h into include/asm Yunhui Cui
2026-07-01 12:46   ` sashiko-bot
2026-07-01 13:46     ` [External] " yunhui cui
2026-07-01 13:12   ` bot+bpf-ci
2026-07-01 12:29 ` [PATCH v6 3/3] riscv: store percpu offset into thread_info Yunhui Cui

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=20260701124030.24B001F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cuiyunhui@bytedance.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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