diff mbox series

lib: fwts_cmos: remove cli/sti assembler from cmos reading

Message ID 20201110172047.3401279-1-colin.king@canonical.com
State Accepted
Headers show
Series lib: fwts_cmos: remove cli/sti assembler from cmos reading | expand

Commit Message

Colin Ian King Nov. 10, 2020, 5:20 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Recent Linux kernel config defaults will not allow messing around with
the interrupt disable/enable from userspace and will segfault the code.
Remove these as they don't really need to be used and we just need to
remember that updates to CMOS data may occur under kernel control
while it is being read by fwts.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_cmos.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Alex Hung Nov. 11, 2020, 5:08 a.m. UTC | #1
On 2020-11-10 10:20 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Recent Linux kernel config defaults will not allow messing around with
> the interrupt disable/enable from userspace and will segfault the code.
> Remove these as they don't really need to be used and we just need to
> remember that updates to CMOS data may occur under kernel control
> while it is being read by fwts.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_cmos.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_cmos.c b/src/lib/src/fwts_cmos.c
> index b40c8100..6b285eac 100644
> --- a/src/lib/src/fwts_cmos.c
> +++ b/src/lib/src/fwts_cmos.c
> @@ -47,7 +47,6 @@ int fwts_cmos_read(const uint8_t offset, uint8_t *value)
>  		goto tidy0x80;
>  	}
>  
> -	asm("cli");
>  	/* specify offset to read */
>  	if (fwts_outb(offset, 0x70) != FWTS_OK) {
>  		ret = FWTS_ERROR;
> @@ -64,7 +63,6 @@ int fwts_cmos_read(const uint8_t offset, uint8_t *value)
>  	if (fwts_inb(0x71, value) != FWTS_OK)
>  		ret = FWTS_ERROR;
>  tidy:
> -	asm("sti");
>  	(void)iopl(0);
>  tidy0x80:
>  	(void)ioperm(0x80, 1, 0);
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Nov. 16, 2020, 6:18 a.m. UTC | #2
On 11/11/20 1:20 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Recent Linux kernel config defaults will not allow messing around with
> the interrupt disable/enable from userspace and will segfault the code.
> Remove these as they don't really need to be used and we just need to
> remember that updates to CMOS data may occur under kernel control
> while it is being read by fwts.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_cmos.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_cmos.c b/src/lib/src/fwts_cmos.c
> index b40c8100..6b285eac 100644
> --- a/src/lib/src/fwts_cmos.c
> +++ b/src/lib/src/fwts_cmos.c
> @@ -47,7 +47,6 @@ int fwts_cmos_read(const uint8_t offset, uint8_t *value)
>  		goto tidy0x80;
>  	}
>  
> -	asm("cli");
>  	/* specify offset to read */
>  	if (fwts_outb(offset, 0x70) != FWTS_OK) {
>  		ret = FWTS_ERROR;
> @@ -64,7 +63,6 @@ int fwts_cmos_read(const uint8_t offset, uint8_t *value)
>  	if (fwts_inb(0x71, value) != FWTS_OK)
>  		ret = FWTS_ERROR;
>  tidy:
> -	asm("sti");
>  	(void)iopl(0);
>  tidy0x80:
>  	(void)ioperm(0x80, 1, 0);
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/lib/src/fwts_cmos.c b/src/lib/src/fwts_cmos.c
index b40c8100..6b285eac 100644
--- a/src/lib/src/fwts_cmos.c
+++ b/src/lib/src/fwts_cmos.c
@@ -47,7 +47,6 @@  int fwts_cmos_read(const uint8_t offset, uint8_t *value)
 		goto tidy0x80;
 	}
 
-	asm("cli");
 	/* specify offset to read */
 	if (fwts_outb(offset, 0x70) != FWTS_OK) {
 		ret = FWTS_ERROR;
@@ -64,7 +63,6 @@  int fwts_cmos_read(const uint8_t offset, uint8_t *value)
 	if (fwts_inb(0x71, value) != FWTS_OK)
 		ret = FWTS_ERROR;
 tidy:
-	asm("sti");
 	(void)iopl(0);
 tidy0x80:
 	(void)ioperm(0x80, 1, 0);