pkarashchenko commented on code in PR #6347:
URL: https://github.com/apache/incubator-nuttx/pull/6347#discussion_r886043418
##########
fs/cromfs/cromfs.h:
##########
@@ -102,20 +102,20 @@ struct cromfs_volume_s
* Return 0
*/
-struct cromfs_node_s
+begin_packed_struct struct cromfs_node_s
{
- uint16_t cn_mode; /* File type, attributes, and access mode bits */
- uint16_t cn_pad; /* Not used */
- uint32_t cn_name; /* Offset from the beginning of the volume header to
the
- * node name string. NUL-terminated. */
- uint32_t cn_size; /* Size of the uncompressed data (in bytes) */
- uint32_t cn_peer; /* Offset to next node in this directory (for
readdir()) */
+ uint16_t cn_mode; /* File type, attributes, and access mode bits */
+ uint16_t cn_pad; /* Not used */
+ uint32_t cn_name; /* Offset from the beginning of the volume header to the
+ * node name string. NUL-terminated. */
+ uint32_t cn_size; /* Size of the uncompressed data (in bytes) */
+ uint32_t cn_peer; /* Offset to next node in this directory (for readdir()) */
union
{
- uint32_t cn_child; /* Offset to first node in sub-directory (directories
only) */
- uint32_t cn_link; /* Offset to an arbitrary node (for hard link) */
- uint32_t cn_blocks; /* Offset to first block of compressed data (for
read) */
+ uint32_t cn_child; /* Offset to first node in sub-directory (directories
only) */
+ uint32_t cn_link; /* Offset to an arbitrary node (for hard link) */
+ uint32_t cn_blocks; /* Offset to first block of compressed data (for read)
*/
} u;
-};
+} end_packed_struct; /* Added to resolve hardFault caused by unaligned memory
access of cromfs nodes. */
Review Comment:
```suggestion
} end_packed_struct; /* Use packed access since cromfs nodes may be
unaligned */
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]