All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Amit Barzilai" <amit.barzilai22@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/ssd130x: fix column and row end address in partial updates for ssd132x
Date: Mon, 22 Jun 2026 12:36:30 +0000	[thread overview]
Message-ID: <20260622123631.8B4A31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260622122604.32500-2-amit.barzilai22@gmail.com>

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

Pre-existing issues:
- [High] Potential 1-byte out-of-bounds read past the heap buffer in `ssd132x_update_rect` when device width is configured to an odd value.
--

commit de1c71cf327dfb3f916baab562b7b1c9945af5e9
Author: Amit Barzilai <amit.barzilai22@gmail.com>

drm/ssd130x: fix column and row end address in partial updates for ssd132x

This commit corrects the relative end addresses used in the "Set Column Address"
and "Set Row Address" commands for SSD132X controllers during partial screen
updates. It ensures that the absolute addresses are correctly calculated and
sent to the controller.

Cc: stable@vger.kernel.org

> diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c
> --- a/drivers/gpu/drm/solomon/ssd130x.c
> +++ b/drivers/gpu/drm/solomon/ssd130x.c

[ ... ]

> @@ -864,12 +864,13 @@ static int ssd132x_update_rect(struct ssd130x_device *ssd130x,
>  	 */
>  
>  	/* Set column start and end */
> -	ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_COL_RANGE, x / segment_width, columns - 1);
> +	ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_COL_RANGE, x / segment_width,
> +				x / segment_width + columns - 1);
>  	if (ret < 0)
>  		return ret;
>  
>  	/* Set row start and end */
> -	ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_ROW_RANGE, y, rows - 1);
> +	ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_ROW_RANGE, y, y + rows - 1);
>  	if (ret < 0)
>  		return ret;
>  
>  	for (i = 0; i < height; i++) {
>  		/* Process pair of pixels and combine them into a single byte */
>  		for (j = 0; j < width; j += segment_width) {
>  			u8 n1 = buf[i * width + j];
>  			u8 n2 = buf[i * width + j + 1];

[Severity: High]
This is a pre-existing issue, but could this loop read out of bounds if the
device tree specifies an odd solomon,width (e.g., 129)?

If the device width is configured to an odd value, the update rectangle's
width can also be odd. The buffer array is allocated in
ssd132x_primary_plane_atomic_check() with exactly pitch * height bytes
(where pitch equals width).

During the last iteration of the final row, j + 1 would evaluate to width.
This causes the n2 assignment to access buf[height * width], which is one
byte past the requested allocation size.

Can this trigger a KASAN out-of-bounds read warning or scramble display
output on odd-width panels by reading across row boundaries?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260622122604.32500-1-amit.barzilai22@gmail.com?part=1

  reply	other threads:[~2026-06-22 12:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 12:26 [PATCH 0/3] drm/ssd130x: fix column and row end address in partial updates of ssd132x and ssd133x devices Amit Barzilai
2026-06-22 12:26 ` [PATCH 1/3] drm/ssd130x: fix column and row end address in partial updates for ssd132x Amit Barzilai
2026-06-22 12:36   ` sashiko-bot [this message]
2026-06-29  8:43     ` Amit Barzilai
2026-06-29  8:56       ` Javier Martinez Canillas
2026-06-30  9:56         ` Amit Barzilai
2026-06-30 10:30           ` Javier Martinez Canillas
2026-06-30 11:08             ` Amit Barzilai
2026-06-30 11:16               ` Javier Martinez Canillas
2026-06-22 12:26 ` [PATCH 2/3] drm/ssd130x: hoist column and row addresses out of repeated division Amit Barzilai
2026-06-22 12:26 ` [PATCH 3/3] drm/ssd130x: fix column and row end address in partial updates in ssd133x Amit Barzilai
2026-07-01 13:23 ` [PATCH 0/3] drm/ssd130x: fix column and row end address in partial updates of ssd132x and ssd133x devices Javier Martinez Canillas
2026-07-06 10:41   ` Javier Martinez Canillas

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=20260622123631.8B4A31F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amit.barzilai22@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.