File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 10
10
#include <unistd.h>
11
11
#include <string.h>
12
12
#include <errno.h>
13
+ #include <endian.h>
13
14
14
15
#include <linux/kernel.h>
15
16
#include <linux/bootconfig.h>
@@ -183,9 +184,11 @@ static int load_xbc_from_initrd(int fd, char **buf)
183
184
184
185
if (read (fd , & size , sizeof (u32 )) < 0 )
185
186
return pr_errno ("Failed to read size" , - errno );
187
+ size = le32toh (size );
186
188
187
189
if (read (fd , & csum , sizeof (u32 )) < 0 )
188
190
return pr_errno ("Failed to read checksum" , - errno );
191
+ csum = le32toh (csum );
189
192
190
193
/* Wrong size error */
191
194
if (stat .st_size < size + 8 + BOOTCONFIG_MAGIC_LEN ) {
@@ -407,10 +410,10 @@ static int apply_xbc(const char *path, const char *xbc_path)
407
410
408
411
/* Add a footer */
409
412
p = data + size ;
410
- * (u32 * )p = size ;
413
+ * (u32 * )p = htole32 ( size ) ;
411
414
p += sizeof (u32 );
412
415
413
- * (u32 * )p = csum ;
416
+ * (u32 * )p = htole32 ( csum ) ;
414
417
p += sizeof (u32 );
415
418
416
419
memcpy (p , BOOTCONFIG_MAGIC , BOOTCONFIG_MAGIC_LEN );
You can’t perform that action at this time.
0 commit comments