[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [RFCv4,15/35] lib/fdt: Fix fdt_address_cell and fdt_size_cell


  • To: Razvan Virtan <virtanrazvan@xxxxxxxxx>
  • From: Justin He <Justin.He@xxxxxxx>
  • Date: Fri, 14 May 2021 04:55:21 +0000
  • Accept-language: en-US, zh-CN
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PYCY+bz94YAqDaFPqyTPS+E+kbdQYb1Y0y6N/WOPXHk=; b=Ump0/kNudHoxh0NSZ9cygSIilRcYWZ2VtLZGXqYcBvcoRAaYitfknzqrh7tXiqAkkdxVMo5imNBfHL9Vgizf0jNbctkjU5jpkjdpUPjRkqJeCJDkHs9wqg4LPE79H2uxuz2OnJxxGLBDe1xH5ck4X4sVN1MeMj1anyxO1vPI2WRxBCZvZ1K3eILRMV8GFg/JcGBOX84Qh2zkSjm58gZn0ig7CYBYxO8dSakrR6LF5y86+yvJ6Hx6jK4Bwi9VwMw8b+hb3P1yo5kEA6GZzn6cIvwmgjyjSfg35mkio4y7yHpCJXHrrRckzeiraQMSFpho2+uzVjC/UF0AuKhvc2X49Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jeWgOXx948kGJ+eLR7GUXsU0gjIapY5k+xDxq5uyuQZeLAvCuybH1M3Qz8KIYHBD01vM2nhk7AQg+1+9+iE9pjDiVRIO30TMOrG3I/yNloH4EWWRFrqt1FxHbNGKkXd8KAxb8qDkrHMyM2eu28MLkVBUOYlCkbgjPbMgxPpxgVLfL3kJo6gez4poftCb8sxL3pS6LuH9XKiPnau7TlB7PS5Qx6E4Gy2xst/Fa42ALq2yQ+fDNtrpaqbDef4VNNDxuQ5m+9+rBO0QVrLOooOhoklm9rSj/a2RA3qAt3yTJKAVWOgnSxYQLR5iyA1AJ5yRGC0XxO4lTi5RJdChJ9RvuA==
  • Authentication-results-original: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com;
  • Cc: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 May 2021 04:55:37 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXJV2DI0d14f70wUKNSBmZfSx9TKrikqjg
  • Thread-topic: [RFCv4,15/35] lib/fdt: Fix fdt_address_cell and fdt_size_cell

Hi Razvan

> -----Original Message-----
> From: Razvan Virtan <virtanrazvan@xxxxxxxxx>
> Sent: Tuesday, March 30, 2021 8:09 PM
> To: Justin He <Justin.He@xxxxxxx>
> Cc: minios-devel@xxxxxxxxxxxxx
> Subject: Re: [RFCv4,15/35] lib/fdt: Fix fdt_address_cell and fdt_size_cell
>
> In the "fdt_address_cell()" description from "libfdt.h", it is specified
> that
> this function should return "-FDT_ERR_BADNCELLS, if the node has a badly
> formatted
> or invalid  #address-cells property" (similarly for "fdt_size_cells()").
>

Okay, will add the error case before returning the value.
--
Cheers,
Justin (Jia He)



> Therefore, shouldn't we keep the following checks:
>
> ```if (len != sizeof(*prop))
>       return -FDT_ERR_BADNCELLS;```
>
> and
>
> ```int val = fdt32_to_cpu(*prop);
>       if ((val <= 0) || (val > FDT_MAX_NCELLS))
>               return -FDT_ERR_BADNCELLS;```
>
> before returning the actual value (or update the description in "libfdt.h")?
>
> Reviewed-by: Razvan Virtan <virtanrazvan@xxxxxxxxx>
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.