All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 3/3] stack_clash: make use of tst_kcmdline_parse
Date: Fri, 8 Mar 2024 09:56:28 +0100	[thread overview]
Message-ID: <20240308085628.GB257921@pevik> (raw)
In-Reply-To: <20240308045230.3106549-3-liwang@redhat.com>

Hi Li,

>  void setup(void)
>  {
> -	char buf[4096], *p;
> +	char *p;
stack_clash.c:276:15: warning: unused variable ‘p’ [-Wunused-variable]
  276 |         char *p;
      |               ^

>  	page_size = sysconf(_SC_PAGESIZE);
>  	page_mask = ~(page_size - 1);

> -	buf[4095] = '\0';
> -	SAFE_FILE_SCANF("/proc/cmdline", "%4095[^\n]", buf);
> +	struct tst_kcmdline_param params = TST_KCMDLINE_INIT("stack_guard_gap");
> +	tst_kcmdline_parse(&params, 1);

> -	if ((p = strstr(buf, "stack_guard_gap=")) != NULL) {
> -		if (sscanf(p, "stack_guard_gap=%ld", &GAP_PAGES) != 1) {
> -			tst_brk(TBROK | TERRNO, "sscanf");
> -			return;
> -		}
> +	if (params.value[0] != '\0') {
> +		GAP_PAGES= atol(params.value);
>  		tst_res(TINFO, "stack_guard_gap = %ld", GAP_PAGES);
>  	}

Otherwise LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-03-08  9:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08  4:52 [LTP] [PATCH 1/3] kconfig: add funtion to parse /proc/cmdline Li Wang
2024-03-08  4:52 ` [LTP] [PATCH 2/3] init_module: To handle kernel module signature enforcement Li Wang
2024-03-08  8:47   ` Petr Vorel
2024-03-09  8:11     ` Li Wang
2024-03-08  4:52 ` [LTP] [PATCH 3/3] stack_clash: make use of tst_kcmdline_parse Li Wang
2024-03-08  8:56   ` Petr Vorel [this message]
2024-03-08  7:12 ` [LTP] [PATCH 1/3] kconfig: add funtion to parse /proc/cmdline Petr Vorel
2024-03-08 16:31 ` Cyril Hrubis
2024-03-09  8:09   ` Li Wang

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=20240308085628.GB257921@pevik \
    --to=pvorel@suse.cz \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /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.