[1/3] platform/x86: ISST: Check for unaligned mmio address
diff mbox series

Message ID 20201204015746.1168941-1-srinivas.pandruvada@linux.intel.com
State Accepted
Commit a552f204b050b213b1e41a5134a0d2726c9a2ec1
Headers show
Series
  • [1/3] platform/x86: ISST: Check for unaligned mmio address
Related show

Commit Message

Srinivas Pandruvada Dec. 4, 2020, 1:57 a.m. UTC
The address should be aligned to 4 byte boundary. So send an error for
unaligned address.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Hans de Goede Dec. 7, 2020, 2:16 p.m. UTC | #1
Hi,

On 12/4/20 2:57 AM, Srinivas Pandruvada wrote:
> The address should be aligned to 4 byte boundary. So send an error for
> unaligned address.
> 
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

Thank you for your patch-series.

One thing which still seems to be missing after this series is a check for
attempting to read/write the hole between the 2 ranges. Can you please
provide a follow-up patch adding such a check?

###

I've applied the series to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
> index aa17fd7817f8..e7e9808a1aed 100644
> --- a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
> +++ b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
> @@ -42,6 +42,9 @@ static long isst_if_mmio_rd_wr(u8 *cmd_ptr, int *write_only, int resume)
>  	if (io_reg->reg < 0x04 || io_reg->reg > 0xD0)
>  		return -EINVAL;
>  
> +	if (io_reg->reg % 4)
> +		return -EINVAL;
> +
>  	if (io_reg->read_write && !capable(CAP_SYS_ADMIN))
>  		return -EPERM;
>  
>

Patch
diff mbox series

diff --git a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
index aa17fd7817f8..e7e9808a1aed 100644
--- a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
+++ b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
@@ -42,6 +42,9 @@  static long isst_if_mmio_rd_wr(u8 *cmd_ptr, int *write_only, int resume)
 	if (io_reg->reg < 0x04 || io_reg->reg > 0xD0)
 		return -EINVAL;
 
+	if (io_reg->reg % 4)
+		return -EINVAL;
+
 	if (io_reg->read_write && !capable(CAP_SYS_ADMIN))
 		return -EPERM;