Skip to content

Commit

Permalink
templates: fix mismatched type size in simple (#140)
Browse files Browse the repository at this point in the history
Fix a mismatched type size error in component.simple.c:485, which may
cause data overflow when CONFIG_WORD_SIZE is 64. Use the CLZL()
macro to correctly handle the specified CONFIG_WORD_SIZE.

Signed-off-by: colorglass <[email protected]>
  • Loading branch information
colorglass authored Feb 2, 2024
1 parent 89af719 commit 11836b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion camkes/templates/component.simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <camkes/error.h>
#include <camkes/tls.h>
#include <vka/kobject_t.h>
#include <utils/builtin.h>

#include <simple/simple.h>

Expand Down Expand Up @@ -482,7 +483,7 @@ void camkes_make_simple(simple_t *simple) {
/*# If there is no size specified in the configuration then we assume the cnode
will be as small as possible to hold all the capabilities that are currently
defined #*/
simple_data.cnodesizebits = CONFIG_WORD_SIZE - __builtin_clz(/*? holding_slot ?*/) + 1;
simple_data.cnodesizebits = CONFIG_WORD_SIZE - CLZL(/*? holding_slot ?*/) + 1;
/*- endif -*/
/*# Find untyped physical addresses. We only care if the untyped is at least a page size #*/
/*- for u in untyped_obj_list -*/
Expand Down

0 comments on commit 11836b1

Please sign in to comment.