diff mbox

[edk2,1/4] ArmVirtPkg/FdtClientDxe: fix check for size of "reg" properties

Message ID 1473946233-10547-2-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 38ed4a9e3a65185e7e7b3c891feab1ddc865fdb5
Headers show

Commit Message

Ard Biesheuvel Sept. 15, 2016, 1:30 p.m. UTC
Currently, the code in FdtClientDxe assumes #address-cells and
of <base, size> tuples, this means the size of the entire property
should always be a multiple of 16 bytes (i.e, 4 * sizeof(UINT32),
not 8. So fix this.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Laszlo Ersek Sept. 15, 2016, 1:38 p.m. UTC | #1
On 09/15/16 15:30, Ard Biesheuvel wrote:
> Currently, the code in FdtClientDxe assumes #address-cells and


s/and/are/?

Reviewed-by: Laszlo Ersek <lersek@redhat.com>


> of <base, size> tuples, this means the size of the entire property

> should always be a multiple of 16 bytes (i.e, 4 * sizeof(UINT32),

> not 8. So fix this.

> 

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c

> index c336e2410033..2063a597323b 100644

> --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c

> +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c

> @@ -178,7 +178,7 @@ FindCompatibleNodeReg (

>      return Status;

>    }

>  

> -  if ((*RegSize % 8) != 0) {

> +  if ((*RegSize % 16) != 0) {

>      DEBUG ((EFI_D_ERROR,

>        "%a: '%a' compatible node has invalid 'reg' property (size == 0x%x)\n",

>        __FUNCTION__, CompatibleString, *RegSize));

> 


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Sept. 15, 2016, 1:40 p.m. UTC | #2
On 15 September 2016 at 14:38, Laszlo Ersek <lersek@redhat.com> wrote:
> On 09/15/16 15:30, Ard Biesheuvel wrote:

>> Currently, the code in FdtClientDxe assumes #address-cells and

>

> s/and/are/?

>


No, amusingly, the second sentence started with #size-cells, and was
dropped completely by git commit due to the leading #. I will try to
remember what I put there, and fix it up when committing.

> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

>


Thanks,
Ard.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
index c336e2410033..2063a597323b 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
@@ -178,7 +178,7 @@  FindCompatibleNodeReg (
     return Status;
   }
 
-  if ((*RegSize % 8) != 0) {
+  if ((*RegSize % 16) != 0) {
     DEBUG ((EFI_D_ERROR,
       "%a: '%a' compatible node has invalid 'reg' property (size == 0x%x)\n",
       __FUNCTION__, CompatibleString, *RegSize));