From: Richard Palethorpe <rpalethorpe@suse.de>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2 4/5] API/cgroup: Make tst_cgroup_group_mk sprintf like
Date: Mon, 07 Feb 2022 08:44:33 +0000 [thread overview]
Message-ID: <87y22nvwn7.fsf@suse.de> (raw)
In-Reply-To: <Yfz5lF4SR0s7bv/N@yuki>
Hello,
Cyril Hrubis <chrubis@suse.cz> writes:
> Hi!
>> Seems this is too strict for some compiling. e.g.
>>
>> cfs_bandwidth01.c: In function ???mk_cpu_cgroup???:
>> cfs_bandwidth01.c:64:9: error: format not a string literal and no format
>> arguments [-Werror=format-security]
>> 64 | *cg = tst_cgroup_group_mk(cg_parent, cg_child_name);
>> | ^
>> cc1: some warnings being treated as errors
>> make: *** [../../../../include/mk/rules.mk:37: cfs_bandwidth01] Error 1
>>
>> gcc version 11.2.1 20211203 (Red Hat 11.2.1-7) (GCC)
Sorry I should have done a full rebuild.
>
> Ah, right, that's the __attribute__ format printf. I guess that we would
> have to live with changing all the calls to
> tst_cgroup_group_mk(foo, "%s", child_name)
Actually it's just calls where the compiler can't tell if child_name is
a string literal. Looking at vsnprintf in stdio.h it seems like we
should be able to add `__attribute__((format(printf,3,0)))` to
mk_cpu_cgroup and then cg_child_name should be guaranteed to be a string
literal. Alas it doesn't work, niether does the format_arg attribute in
this case.
I guess if I made a va arg version of tst_cgroup_group_mk then it would
work, but this is starting to get silly. So I'll just do "%s".
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-02-07 9:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 8:18 [LTP] [PATCH v2 0/5] Add memcontrol03 and declarative CG API Richard Palethorpe via ltp
2022-02-03 8:18 ` [LTP] [PATCH v2 1/5] memcontrol: Lift out some common definitions into a shared header Richard Palethorpe via ltp
2022-02-03 13:04 ` Cyril Hrubis
2022-02-04 7:42 ` Li Wang
2022-02-03 8:18 ` [LTP] [PATCH v2 2/5] API/cgroup: Declare required controllers and version in test struct Richard Palethorpe via ltp
2022-02-03 13:03 ` Cyril Hrubis
2022-02-04 7:37 ` Li Wang
2022-02-07 13:18 ` Richard Palethorpe
2022-02-03 8:18 ` [LTP] [PATCH v2 3/5] API/cgroup: Add memory.min Richard Palethorpe via ltp
2022-02-03 13:13 ` Cyril Hrubis
2022-02-07 11:36 ` Richard Palethorpe
2022-02-03 8:18 ` [LTP] [PATCH v2 4/5] API/cgroup: Allow formatting of new cg names Richard Palethorpe via ltp
2022-02-03 8:18 ` [LTP] [PATCH v2 4/5] API/cgroup: Make tst_cgroup_group_mk sprintf like Richard Palethorpe via ltp
2022-02-03 13:20 ` Cyril Hrubis
2022-02-04 6:41 ` Li Wang
2022-02-04 10:01 ` Cyril Hrubis
2022-02-07 8:44 ` Richard Palethorpe [this message]
2022-02-03 8:18 ` [LTP] [PATCH v2 5/5] memcontrol03: Copy from kselftest Richard Palethorpe via ltp
2022-02-03 13:52 ` Cyril Hrubis
2022-02-07 9:46 ` Richard Palethorpe
2022-02-08 8:03 ` 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=87y22nvwn7.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=chrubis@suse.cz \
--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.