Skip to content

Commit e8e19d2

Browse files
muditsharmaa-armadeaarm
authored andcommitted
Tools: Fix struct size assert logic in struct_pack
The output struct can be padded upto a certain `size` and cannot exceed it. Signed-off-by: Mudit Sharma <mudit.sharma@arm.com> Change-Id: I4dc4f734bf76df16171a8ce0b0723b0346f6e81f
1 parent 168080d commit e8e19d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/modules/struct_pack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ def struct_pack(objects, pad_to=0):
1818
size = struct.calcsize(defstring)
1919
if size < pad_to:
2020
defstring += str(pad_to - size) + "x"
21-
assert size < pad_to or pad_to == 0, "Error padding struct of size {} to {}".format(size, pad_to)
21+
assert size <= pad_to or pad_to == 0, "Error padding struct of size {} to {}".format(size, pad_to)
2222

2323
return (bytes(struct.pack(defstring, *objects)))

0 commit comments

Comments
 (0)