fs/signalfd: fix build error for BUS_MCEERR_AR
diff mbox

Message ID 8a85cfae-0c26-e50c-9b26-582802a7f3eb@infradead.org
State New
Headers show

Commit Message

Randy Dunlap Feb. 12, 2018, 9:18 p.m. UTC
From: Randy Dunlap <rdunlap@infradead.org>

Fix build error in fs/signalfd.c by using same method that is used in
kernel/signal.c: separate blocks for different signal si_code values.

./fs/signalfd.c: error: 'BUS_MCEERR_AR' undeclared (first use in this function)

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
---
 fs/signalfd.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Applies to mainline 4.16-rc1.

Comments

Eric W. Biederman Feb. 13, 2018, 2:18 a.m. UTC | #1
Randy Dunlap <rdunlap@infradead.org> writes:

> From: Randy Dunlap <rdunlap@infradead.org>
>
> Fix build error in fs/signalfd.c by using same method that is used in
> kernel/signal.c: separate blocks for different signal si_code values.
>
> ./fs/signalfd.c: error: 'BUS_MCEERR_AR' undeclared (first use in this function)
>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Eric Biederman <ebiederm@xmission.com>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

Do you want to me to pick this one up?  Or does it have another path
into mainline?

Eric

> ---
>  fs/signalfd.c |   15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> Applies to mainline 4.16-rc1.
>
> --- linux-next-20180212.orig/fs/signalfd.c
> +++ linux-next-20180212/fs/signalfd.c
> @@ -118,13 +118,22 @@ static int signalfd_copyinfo(struct sign
>  		err |= __put_user(kinfo->si_trapno, &uinfo->ssi_trapno);
>  #endif
>  #ifdef BUS_MCEERR_AO
> -		/* 
> +		/*
>  		 * Other callers might not initialize the si_lsb field,
>  		 * so check explicitly for the right codes here.
>  		 */
>  		if (kinfo->si_signo == SIGBUS &&
> -		    (kinfo->si_code == BUS_MCEERR_AR ||
> -		     kinfo->si_code == BUS_MCEERR_AO))
> +		     kinfo->si_code == BUS_MCEERR_AO)
> +			err |= __put_user((short) kinfo->si_addr_lsb,
> +					  &uinfo->ssi_addr_lsb);
> +#endif
> +#ifdef BUS_MCEERR_AR
> +		/*
> +		 * Other callers might not initialize the si_lsb field,
> +		 * so check explicitly for the right codes here.
> +		 */
> +		if (kinfo->si_signo == SIGBUS &&
> +		    kinfo->si_code == BUS_MCEERR_AR)
>  			err |= __put_user((short) kinfo->si_addr_lsb,
>  					  &uinfo->ssi_addr_lsb);
>  #endif
Randy Dunlap Feb. 13, 2018, 2:19 a.m. UTC | #2
On 02/12/2018 06:18 PM, Eric W. Biederman wrote:
> Randy Dunlap <rdunlap@infradead.org> writes:
> 
>> From: Randy Dunlap <rdunlap@infradead.org>
>>
>> Fix build error in fs/signalfd.c by using same method that is used in
>> kernel/signal.c: separate blocks for different signal si_code values.
>>
>> ./fs/signalfd.c: error: 'BUS_MCEERR_AR' undeclared (first use in this function)
>>
>> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>> Cc: Eric Biederman <ebiederm@xmission.com>
>> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> 
> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Do you want to me to pick this one up?  Or does it have another path
> into mainline?
> 

Just via you or Al. You might as well take it.

Thanks.

> 
>> ---
>>  fs/signalfd.c |   15 ++++++++++++---
>>  1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> Applies to mainline 4.16-rc1.
>>
>> --- linux-next-20180212.orig/fs/signalfd.c
>> +++ linux-next-20180212/fs/signalfd.c
>> @@ -118,13 +118,22 @@ static int signalfd_copyinfo(struct sign
>>  		err |= __put_user(kinfo->si_trapno, &uinfo->ssi_trapno);
>>  #endif
>>  #ifdef BUS_MCEERR_AO
>> -		/* 
>> +		/*
>>  		 * Other callers might not initialize the si_lsb field,
>>  		 * so check explicitly for the right codes here.
>>  		 */
>>  		if (kinfo->si_signo == SIGBUS &&
>> -		    (kinfo->si_code == BUS_MCEERR_AR ||
>> -		     kinfo->si_code == BUS_MCEERR_AO))
>> +		     kinfo->si_code == BUS_MCEERR_AO)
>> +			err |= __put_user((short) kinfo->si_addr_lsb,
>> +					  &uinfo->ssi_addr_lsb);
>> +#endif
>> +#ifdef BUS_MCEERR_AR
>> +		/*
>> +		 * Other callers might not initialize the si_lsb field,
>> +		 * so check explicitly for the right codes here.
>> +		 */
>> +		if (kinfo->si_signo == SIGBUS &&
>> +		    kinfo->si_code == BUS_MCEERR_AR)
>>  			err |= __put_user((short) kinfo->si_addr_lsb,
>>  					  &uinfo->ssi_addr_lsb);
>>  #endif

Patch
diff mbox

--- linux-next-20180212.orig/fs/signalfd.c
+++ linux-next-20180212/fs/signalfd.c
@@ -118,13 +118,22 @@  static int signalfd_copyinfo(struct sign
 		err |= __put_user(kinfo->si_trapno, &uinfo->ssi_trapno);
 #endif
 #ifdef BUS_MCEERR_AO
-		/* 
+		/*
 		 * Other callers might not initialize the si_lsb field,
 		 * so check explicitly for the right codes here.
 		 */
 		if (kinfo->si_signo == SIGBUS &&
-		    (kinfo->si_code == BUS_MCEERR_AR ||
-		     kinfo->si_code == BUS_MCEERR_AO))
+		     kinfo->si_code == BUS_MCEERR_AO)
+			err |= __put_user((short) kinfo->si_addr_lsb,
+					  &uinfo->ssi_addr_lsb);
+#endif
+#ifdef BUS_MCEERR_AR
+		/*
+		 * Other callers might not initialize the si_lsb field,
+		 * so check explicitly for the right codes here.
+		 */
+		if (kinfo->si_signo == SIGBUS &&
+		    kinfo->si_code == BUS_MCEERR_AR)
 			err |= __put_user((short) kinfo->si_addr_lsb,
 					  &uinfo->ssi_addr_lsb);
 #endif