public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	 Robert O'Callahan <robert@ocallahan.org>,
	 "Dmitry V . Levin" <ldv@altlinux.org>
Subject: Re: [PATCH 2/6] sysvipc: Return EINVAL for invalid semctl commands
Date: Mon, 28 Sep 2020 18:33:57 +0200	[thread overview]
Message-ID: <87wo0d274a.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <20200928144556.239160-2-adhemerval.zanella@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Mon, 28 Sep 2020 11:45:52 -0300")

* Adhemerval Zanella via Libc-alpha:

> diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
> index 1cdabde8f2..dcff6e691d 100644
> --- a/sysdeps/unix/sysv/linux/semctl.c
> +++ b/sysdeps/unix/sysv/linux/semctl.c
> @@ -158,6 +158,15 @@ __semctl64 (int semid, int semnum, int cmd, ...)
>        arg64 = va_arg (ap, union semun64);
>        va_end (ap);
>        break;
> +    case IPC_RMID:      /* arg ignored. */

Missing space after “.”.

> +/* Return the first invalid command SysV IPC command for shared memory.  */
> +static inline int
> +first_shm_invalid_cmd (void)
> +{
> +  const int shm_cmds[] = {
> +    SHM_STAT,
> +    SHM_INFO,
> +#ifdef SHM_STAT_ANY
> +    SHM_STAT_ANY,
> +#endif
> +  };
> +
> +  int invalid = first_common_invalid_cmd ();
> +  for (int i = 0; i < array_length (shm_cmds); i++)
> +    {
> +      if (invalid == shm_cmds[i])
> +	{
> +	  invalid++;
> +	  i = 0;
> +	}
> +    }
> +
> +  return invalid;
> +}

I think this change should go into the shmctl patch?  Maybe add the
tests separately at the end? 

Rest looks okay to me.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


  reply	other threads:[~2020-09-28 16:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 14:45 [PATCH 1/6] sysvipc: Fix SEM_STAT_ANY kernel argument pass [BZ #26637] Adhemerval Zanella
2020-09-28 14:45 ` [PATCH 2/6] sysvipc: Return EINVAL for invalid semctl commands Adhemerval Zanella
2020-09-28 16:33   ` Florian Weimer [this message]
2020-09-28 21:07     ` Adhemerval Zanella
2020-09-28 14:45 ` [PATCH 3/6] sysvipc: Fix IPC_INFO and MSG_INFO handling [BZ #26639] Adhemerval Zanella
2020-09-28 14:55   ` Andreas Schwab
2020-09-29  7:57   ` Florian Weimer
2020-09-29 12:37     ` Adhemerval Zanella
2020-09-29 12:58       ` Adhemerval Zanella
2020-09-29 13:01         ` Florian Weimer
2020-09-29 13:04           ` Adhemerval Zanella
2020-09-28 14:45 ` [PATCH 4/6] sysvipc: Return EINVAL for invalid msgctl commands Adhemerval Zanella
2020-09-29  7:58   ` Florian Weimer
2020-09-29 13:26     ` Adhemerval Zanella
2020-09-29 17:05       ` Florian Weimer
2020-09-28 14:45 ` [PATCH 5/6] sysvipc: Fix IPC_INFO and SHM_INFO handling [BZ #26636] Adhemerval Zanella
2020-09-28 14:45 ` [PATCH 6/6] sysvipc: Return EINVAL for invalid shmctl commands Adhemerval Zanella
2020-09-28 14:59 ` [PATCH 1/6] sysvipc: Fix SEM_STAT_ANY kernel argument pass [BZ #26637] Florian Weimer
2020-09-28 21:06   ` Adhemerval Zanella

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=87wo0d274a.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=ldv@altlinux.org \
    --cc=libc-alpha@sourceware.org \
    --cc=robert@ocallahan.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).