public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] accel/qaic: fix incorrect counter check in RAS message decode
@ 2026-04-10 11:20 Alok Tiwari
  2026-04-10 17:08 ` Jeff Hugo
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alok Tiwari @ 2026-04-10 11:20 UTC (permalink / raw)
  To: maciej.falkowski, jacek.lawrynowicz, quic_thanson, jeff.hugo,
	carl.vanderlip, ogabbay, linux-arm-msm, dri-devel
  Cc: alok.a.tiwarilinux, alok.a.tiwari

The UE and UE_NF cases check ce_count against UINT_MAX before incrementing
their respective counters. This is logically incorrect and prevents
ue_count and ue_nf_count from incrementing when ce_count reaches UINT_MAX.

Fixes: c11a50b170e7 ("accel/qaic: Add Reliability, Accessibility, Serviceability (RAS)")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/accel/qaic/qaic_ras.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/accel/qaic/qaic_ras.c b/drivers/accel/qaic/qaic_ras.c
index cc0b75461e1a..6791af366cba 100644
--- a/drivers/accel/qaic/qaic_ras.c
+++ b/drivers/accel/qaic/qaic_ras.c
@@ -497,11 +497,11 @@ static void decode_ras_msg(struct qaic_device *qdev, struct ras_data *msg)
 			qdev->ce_count++;
 		break;
 	case UE:
-		if (qdev->ce_count != UINT_MAX)
+		if (qdev->ue_count != UINT_MAX)
 			qdev->ue_count++;
 		break;
 	case UE_NF:
-		if (qdev->ce_count != UINT_MAX)
+		if (qdev->ue_nf_count != UINT_MAX)
 			qdev->ue_nf_count++;
 		break;
 	default:
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] accel/qaic: fix incorrect counter check in RAS message decode
  2026-04-10 11:20 [PATCH] accel/qaic: fix incorrect counter check in RAS message decode Alok Tiwari
@ 2026-04-10 17:08 ` Jeff Hugo
  2026-04-10 17:08 ` Jeff Hugo
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jeff Hugo @ 2026-04-10 17:08 UTC (permalink / raw)
  To: Alok Tiwari, maciej.falkowski, jacek.lawrynowicz, quic_thanson,
	carl.vanderlip, ogabbay, linux-arm-msm, dri-devel
  Cc: alok.a.tiwarilinux

On 4/10/2026 5:20 AM, Alok Tiwari wrote:
> The UE and UE_NF cases check ce_count against UINT_MAX before incrementing
> their respective counters. This is logically incorrect and prevents
> ue_count and ue_nf_count from incrementing when ce_count reaches UINT_MAX.

Nice catch. I'm curious, how did you find this?

-Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] accel/qaic: fix incorrect counter check in RAS message decode
  2026-04-10 11:20 [PATCH] accel/qaic: fix incorrect counter check in RAS message decode Alok Tiwari
  2026-04-10 17:08 ` Jeff Hugo
@ 2026-04-10 17:08 ` Jeff Hugo
  2026-04-11 23:40 ` Claude review: " Claude Code Review Bot
  2026-04-11 23:40 ` Claude Code Review Bot
  3 siblings, 0 replies; 5+ messages in thread
From: Jeff Hugo @ 2026-04-10 17:08 UTC (permalink / raw)
  To: Alok Tiwari, maciej.falkowski, jacek.lawrynowicz, quic_thanson,
	carl.vanderlip, ogabbay, linux-arm-msm, dri-devel
  Cc: alok.a.tiwarilinux

On 4/10/2026 5:20 AM, Alok Tiwari wrote:
> The UE and UE_NF cases check ce_count against UINT_MAX before incrementing
> their respective counters. This is logically incorrect and prevents
> ue_count and ue_nf_count from incrementing when ce_count reaches UINT_MAX.
> 
> Fixes: c11a50b170e7 ("accel/qaic: Add Reliability, Accessibility, Serviceability (RAS)")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>

Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Claude review: accel/qaic: fix incorrect counter check in RAS message decode
  2026-04-10 11:20 [PATCH] accel/qaic: fix incorrect counter check in RAS message decode Alok Tiwari
                   ` (2 preceding siblings ...)
  2026-04-11 23:40 ` Claude review: " Claude Code Review Bot
@ 2026-04-11 23:40 ` Claude Code Review Bot
  3 siblings, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-04-11 23:40 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: accel/qaic: fix incorrect counter check in RAS message decode
Author: Alok Tiwari <alok.a.tiwari@oracle.com>
Patches: 3
Reviewed: 2026-04-12T09:40:28.470501

---

This is a single-patch fix for a clear copy-paste bug in the QAIC accelerator RAS (Reliability, Accessibility, Serviceability) error counter logic. The fix is correct, minimal, and obviously right. The bug was introduced in commit c11a50b170e7 and causes `ue_count` and `ue_nf_count` to be gated by the wrong overflow check — they look at `ce_count` instead of their own counter. This means those counters stop incrementing once `ce_count` (not the relevant counter) saturates at `UINT_MAX`, which is both functionally wrong and could mask uncorrectable error reporting.

**Verdict: This patch should be accepted.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Claude review: accel/qaic: fix incorrect counter check in RAS message decode
  2026-04-10 11:20 [PATCH] accel/qaic: fix incorrect counter check in RAS message decode Alok Tiwari
  2026-04-10 17:08 ` Jeff Hugo
  2026-04-10 17:08 ` Jeff Hugo
@ 2026-04-11 23:40 ` Claude Code Review Bot
  2026-04-11 23:40 ` Claude Code Review Bot
  3 siblings, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-04-11 23:40 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Status: Looks good / Correct fix**

The bug is in `decode_ras_msg()` at `drivers/accel/qaic/qaic_ras.c:500,504`. The switch statement handles three RAS error types — `CE`, `UE`, and `UE_NF` — and each case should check its own counter against `UINT_MAX` before incrementing to prevent overflow. However, the `UE` and `UE_NF` cases both incorrectly check `ce_count`:

```c
case UE:
	if (qdev->ce_count != UINT_MAX)   // BUG: should be ue_count
		qdev->ue_count++;
	break;
case UE_NF:
	if (qdev->ce_count != UINT_MAX)   // BUG: should be ue_nf_count
		qdev->ue_nf_count++;
	break;
```

The fix correctly changes these to check the matching counter:

```c
case UE:
	if (qdev->ue_count != UINT_MAX)
		qdev->ue_count++;
	break;
case UE_NF:
	if (qdev->ue_nf_count != UINT_MAX)
		qdev->ue_nf_count++;
	break;
```

This is a textbook copy-paste error — the `CE` case was likely written first, and the guard condition was duplicated to `UE` and `UE_NF` without updating the variable name. The fix is minimal and obviously correct. The `Fixes:` tag is present and points to the commit that introduced the bug.

No concerns with this patch.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-11 23:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 11:20 [PATCH] accel/qaic: fix incorrect counter check in RAS message decode Alok Tiwari
2026-04-10 17:08 ` Jeff Hugo
2026-04-10 17:08 ` Jeff Hugo
2026-04-11 23:40 ` Claude review: " Claude Code Review Bot
2026-04-11 23:40 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox