public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls: newuname01: Convert to the new library.
Date: Thu, 5 Mar 2026 15:25:44 +0100	[thread overview]
Message-ID: <aamSaHica1WmVDIT@yuki.lan> (raw)
In-Reply-To: <aajhsZYkb9WqTho2@redhat.com>

Hi!1
> > +	SAFE_FILE_SCANF("/proc/sys/kernel/hostname", "%1023[^\n]", proc_val);
> > +	TST_EXP_EQ_STR(name->nodename, proc_val);
> >  
> > -	tst_parse_opts(ac, av, NULL, NULL);
> > +	SAFE_FILE_SCANF("/proc/sys/kernel/osrelease", "%1023[^\n]", proc_val);
> > +	TST_EXP_EQ_STR(name->release, proc_val);
> >  
> > -	setup();
> > +	SAFE_FILE_SCANF("/proc/sys/kernel/version", "%1023[^\n]", proc_val);
> > +	TST_EXP_EQ_STR(name->version, proc_val);
> 
> We'd better clear proc_val between reads:
> 
>   proc_val[0] = '\0';

I'm looking at safe_file_scanf() code and it calls tst_brkm_() in any
case that no conversion was done. So the buffer should be either be
filled with new data or the test should exit with an error. Do I miss
something?

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2026-03-05 14:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 16:14 [LTP] [PATCH] syscalls: newuname01: Convert to the new library Cyril Hrubis
2026-03-05  1:51 ` Li Wang via ltp
2026-03-05 14:25   ` Cyril Hrubis [this message]
2026-03-06  2:58     ` Li Wang via ltp
2026-03-12 13:26 ` Andrea Cervesato via ltp
2026-04-07 12:08   ` Cyril Hrubis

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=aamSaHica1WmVDIT@yuki.lan \
    --to=chrubis@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox