Skip to content

Commit 0154f59

Browse files
committed
Get rid of a magic number.
Signed-off-by: Amy Ringo <me@remexre.com>
1 parent 186412a commit 0154f59

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/kernel/mm/physical_alloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ void mm_init_physical(struct devicetree_node *devicetree) {
170170
child != &devicetree->children; child = child->next) {
171171
struct devicetree_node *node =
172172
container_of(child, struct devicetree_node, parent_children_head);
173-
if (strlen(node->name) < 7 || memcmp(node->name, "memory@", 7))
173+
if (strlen(node->name) < sizeof("memory@") - 1 ||
174+
memcmp(node->name, "memory@", sizeof("memory@") - 1))
174175
continue;
175176

176177
// Run consider_physical_memory() on each one's reg property.

0 commit comments

Comments
 (0)