login: Add nonstring attributes to struct utmpx [BZ #24899]

Message ID 87mugdjoxw.fsf@oldenburg2.str.redhat.com
State Superseded
Headers

Commit Message

Florian Weimer Aug. 13, 2019, 11:16 a.m. UTC
  * Florian Weimer:

> Commit 7532837d7b03b3ca5b9a63d77a5bd81dd23f3d9c ("The
> -Wstringop-truncation option new in GCC 8 detects common misuses")
> added __attribute_nonstring__ to bits/utmp.h, but it did not update
> the parallel bits/utmpx.h header.
>
> 2019-08-12  Florian Weimer  <fweimer@redhat.com>
>
> 	[BZ #24899]
> 	* sysdeps/gnu/bits/utmpx.h (struct utmpx): Add
> 	__attribute_nonstring__ to ut_line, ut_user, ut_host.

I forgot to update the s390 header.  The patch below fixes this.

Thanks,
Florian

login: Add nonstring attributes to struct utmpx [BZ #24899]

Commit 7532837d7b03b3ca5b9a63d77a5bd81dd23f3d9c ("The
-Wstringop-truncation option new in GCC 8 detects common misuses")
added __attribute_nonstring__ to bits/utmp.h, but it did not update
the parallel bits/utmpx.h header.

2019-08-13  Florian Weimer  <fweimer@redhat.com>

	[BZ #24899]
	* sysdeps/gnu/bits/utmpx.h (struct utmpx): Add
	__attribute_nonstring__ to ut_line, ut_user, ut_host.
	* sysdeps/unix/sysv/linux/s390/bits/utmpx.h (struct utmpx):
	Likewise.
  

Comments

Adhemerval Zanella Aug. 13, 2019, 3:01 p.m. UTC | #1
On 13/08/2019 08:16, Florian Weimer wrote:
> * Florian Weimer:
> 
>> Commit 7532837d7b03b3ca5b9a63d77a5bd81dd23f3d9c ("The
>> -Wstringop-truncation option new in GCC 8 detects common misuses")
>> added __attribute_nonstring__ to bits/utmp.h, but it did not update
>> the parallel bits/utmpx.h header.
>>
>> 2019-08-12  Florian Weimer  <fweimer@redhat.com>
>>
>> 	[BZ #24899]
>> 	* sysdeps/gnu/bits/utmpx.h (struct utmpx): Add
>> 	__attribute_nonstring__ to ut_line, ut_user, ut_host.
> 
> I forgot to update the s390 header.  The patch below fixes this.
> 
> Thanks,
> Florian
> 
> login: Add nonstring attributes to struct utmpx [BZ #24899]
> 
> Commit 7532837d7b03b3ca5b9a63d77a5bd81dd23f3d9c ("The
> -Wstringop-truncation option new in GCC 8 detects common misuses")
> added __attribute_nonstring__ to bits/utmp.h, but it did not update
> the parallel bits/utmpx.h header.
> 
> 2019-08-13  Florian Weimer  <fweimer@redhat.com>
> 
> 	[BZ #24899]
> 	* sysdeps/gnu/bits/utmpx.h (struct utmpx): Add
> 	__attribute_nonstring__ to ut_line, ut_user, ut_host.
> 	* sysdeps/unix/sysv/linux/s390/bits/utmpx.h (struct utmpx):
> 	Likewise.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> 
> diff --git a/sysdeps/gnu/bits/utmpx.h b/sysdeps/gnu/bits/utmpx.h
> index 472a7d57d3..36259dbae1 100644
> --- a/sysdeps/gnu/bits/utmpx.h
> +++ b/sysdeps/gnu/bits/utmpx.h
> @@ -56,10 +56,13 @@ struct utmpx
>  {
>    short int ut_type;		/* Type of login.  */
>    __pid_t ut_pid;		/* Process ID of login process.  */
> -  char ut_line[__UT_LINESIZE];	/* Devicename.  */
> +  char ut_line[__UT_LINESIZE]
> +    __attribute_nonstring__;	/* Devicename.  */
>    char ut_id[4];		/* Inittab ID. */
> -  char ut_user[__UT_NAMESIZE];	/* Username.  */
> -  char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
> +  char ut_user[__UT_NAMESIZE]
> +    __attribute_nonstring__;	/* Username.  */
> +  char ut_host[__UT_HOSTSIZE]
> +    __attribute_nonstring__;	/* Hostname for remote login.  */
>    struct __exit_status ut_exit;	/* Exit status of a process marked
>  				   as DEAD_PROCESS.  */
>  
> diff --git a/sysdeps/unix/sysv/linux/s390/bits/utmpx.h b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
> index ea3e860a2d..dab099994a 100644
> --- a/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
> +++ b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
> @@ -56,10 +56,13 @@ struct utmpx
>  {
>    short int ut_type;		/* Type of login.  */
>    __pid_t ut_pid;		/* Process ID of login process.  */
> -  char ut_line[__UT_LINESIZE];	/* Devicename.  */
> +  char ut_line[__UT_LINESIZE]
> +    __attribute_nonstring__;	/* Devicename.  */
>    char ut_id[4];		/* Inittab ID. */
> -  char ut_user[__UT_NAMESIZE];	/* Username.  */
> -  char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
> +  char ut_user[__UT_NAMESIZE]
> +    __attribute_nonstring__;	/* Username.  */
> +  char ut_host[__UT_HOSTSIZE]
> +    __attribute_nonstring__;	/* Hostname for remote login.  */
>    struct __exit_status ut_exit;	/* Exit status of a process marked
>  				   as DEAD_PROCESS.  */
>  
>
  

Patch

diff --git a/sysdeps/gnu/bits/utmpx.h b/sysdeps/gnu/bits/utmpx.h
index 472a7d57d3..36259dbae1 100644
--- a/sysdeps/gnu/bits/utmpx.h
+++ b/sysdeps/gnu/bits/utmpx.h
@@ -56,10 +56,13 @@  struct utmpx
 {
   short int ut_type;		/* Type of login.  */
   __pid_t ut_pid;		/* Process ID of login process.  */
-  char ut_line[__UT_LINESIZE];	/* Devicename.  */
+  char ut_line[__UT_LINESIZE]
+    __attribute_nonstring__;	/* Devicename.  */
   char ut_id[4];		/* Inittab ID. */
-  char ut_user[__UT_NAMESIZE];	/* Username.  */
-  char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
+  char ut_user[__UT_NAMESIZE]
+    __attribute_nonstring__;	/* Username.  */
+  char ut_host[__UT_HOSTSIZE]
+    __attribute_nonstring__;	/* Hostname for remote login.  */
   struct __exit_status ut_exit;	/* Exit status of a process marked
 				   as DEAD_PROCESS.  */
 
diff --git a/sysdeps/unix/sysv/linux/s390/bits/utmpx.h b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
index ea3e860a2d..dab099994a 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
@@ -56,10 +56,13 @@  struct utmpx
 {
   short int ut_type;		/* Type of login.  */
   __pid_t ut_pid;		/* Process ID of login process.  */
-  char ut_line[__UT_LINESIZE];	/* Devicename.  */
+  char ut_line[__UT_LINESIZE]
+    __attribute_nonstring__;	/* Devicename.  */
   char ut_id[4];		/* Inittab ID. */
-  char ut_user[__UT_NAMESIZE];	/* Username.  */
-  char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
+  char ut_user[__UT_NAMESIZE]
+    __attribute_nonstring__;	/* Username.  */
+  char ut_host[__UT_HOSTSIZE]
+    __attribute_nonstring__;	/* Hostname for remote login.  */
   struct __exit_status ut_exit;	/* Exit status of a process marked
 				   as DEAD_PROCESS.  */