public inbox for ltp@lists.linux.it
 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] syscalls/sched_getattr02: use a fixed size for EINVAL test
Date: Mon, 4 Nov 2024 10:13:05 +0100	[thread overview]
Message-ID: <20241104091305.GA1382167@pevik> (raw)
In-Reply-To: <CAEemH2fp41P8f1_BG=3uTgCo3eG49Bq8_kntz0+oj=pDS5DxPA@mail.gmail.com>

Hi Jan, Li,

> Jan Stancek <jstancek@redhat.com> wrote:


> > -       {&pid, &attr_copy, sizeof(struct sched_attr) - 1, 0, EINVAL},
> > +       {&pid, &attr_copy, 47, 0, EINVAL},

LGTM. But using "SCHED_ATTR_SIZE_VER0 - 1" would be more descriptive than magic
number 47. But for that we would need to add a fallaback definition to
include/lapi/sched.h. But sure, it's described in the commit message, thus
documented.

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

> "EINVAL size is invalid; that is, it is smaller than the initial version of
> the sched_attr structure (48 bytes) or larger than the system page size."

> Or we could add one more item for testing 'page_size + 1'.

+1 (having to tests).

Kind regards,
Petr

> Anyway, this workaround looks good.
> Reviewed-by: Li Wang <liwang@redhat.com>

+++ include/lapi/sched.h
@@ -46,6 +46,8 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
 {
 	return syscall(__NR_sched_getattr, pid, attr, size, flags);
 }
+#else
+# define SCHED_ATTR_SIZE_VER0	48	/* sizeof first published struct */
 #endif
 
 #ifndef HAVE_CLONE3

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

  reply	other threads:[~2024-11-04  9:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 13:02 [LTP] [PATCH] syscalls/sched_getattr02: use a fixed size for EINVAL test Jan Stancek
2024-11-02  3:18 ` Li Wang
2024-11-04  9:13   ` Petr Vorel [this message]
2024-11-04  9:53     ` Jan Stancek
2024-11-04 10:31       ` Petr Vorel

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