Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	"Gustavo Sousa" <gustavo.sousa@intel.com>,
	"Ryszard Knop" <ryszard.knop@intel.com>
Subject: Re: [PATCH i-g-t] lib/igt_hook: Fix realloc size to avoid memory overwriting
Date: Mon, 29 Jun 2026 15:37:16 +0300	[thread overview]
Message-ID: <8839c171056ebba69ab979bb3b43dbacc0c76a0e@intel.com> (raw)
In-Reply-To: <20260629115408.158220-2-zbigniew.kempczynski@intel.com>

On Mon, 29 Jun 2026, Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> wrote:
> Doubling test name size might be not enough for realloc if target name
> length is larger than test/subtest name size.

Might one to point out (if) this is the cause for the segfaults we've
been seeing in CI.

BR,
Jani.

>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> Cc: Ryszard Knop <ryszard.knop@intel.com>
> ---
>  lib/igt_hook.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/igt_hook.c b/lib/igt_hook.c
> index b8f25b6c7a..a44b852da1 100644
> --- a/lib/igt_hook.c
> +++ b/lib/igt_hook.c
> @@ -300,7 +300,7 @@ static void igt_hook_update_test_name_pre_call(struct igt_hook *igt_hook, struct
>  	if (len + 1 > *size_ptr) {
>  		size_t fullname_size;
>  
> -		*size_ptr *= 2;
> +		*size_ptr += len + 1;
>  		*name_ptr = realloc(*name_ptr, *size_ptr);
>  
>  		fullname_size = igt_hook_calc_test_fullname_size(igt_hook);

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2026-06-29 12:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 11:54 [PATCH i-g-t] lib/igt_hook: Fix realloc size to avoid memory overwriting Zbigniew Kempczyński
2026-06-29 11:59 ` Knop, Ryszard
2026-06-29 12:17 ` Gustavo Sousa
2026-06-29 15:38   ` Zbigniew Kempczyński
2026-06-29 16:32   ` Zbigniew Kempczyński
2026-06-29 22:33     ` Gustavo Sousa
2026-06-29 12:37 ` Jani Nikula [this message]
2026-06-29 12:37   ` Jani Nikula
2026-06-29 15:40     ` Zbigniew Kempczyński
2026-06-29 22:50 ` ✗ Fi.CI.BAT: failure for " Patchwork

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=8839c171056ebba69ab979bb3b43dbacc0c76a0e@intel.com \
    --to=jani.nikula@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=ryszard.knop@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