[PATCH] scripts:force conversion argument type

Dong Chuanjian posted 1 patch 4 years ago
scripts/kallsyms.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] scripts:force conversion argument type
Posted by Dong Chuanjian 4 years ago
scripts:force conversion argument type

Signed-off-by: Dong Chuanjian <chuanjian@nfschina.com>
---
 scripts/kallsyms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 8caabddf817c..544ab1e1b5ca 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -498,7 +498,7 @@ static void write_src(void)
 
 	output_label("kallsyms_token_index");
 	for (i = 0; i < 256; i++)
-		printf("\t.short\t%d\n", best_idx[i]);
+		printf("\t.short\t%d\n", (int)best_idx[i]);
 	printf("\n");
 }
 
-- 
2.18.2
Re: [PATCH] scripts:force conversion argument type
Posted by Randy Dunlap 4 years ago

On 5/11/22 19:38, Dong Chuanjian wrote:
> scripts:force conversion argument type
> 
> Signed-off-by: Dong Chuanjian <chuanjian@nfschina.com>
> ---
>  scripts/kallsyms.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index 8caabddf817c..544ab1e1b5ca 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -498,7 +498,7 @@ static void write_src(void)
>  
>  	output_label("kallsyms_token_index");
>  	for (i = 0; i < 256; i++)
> -		printf("\t.short\t%d\n", best_idx[i]);
> +		printf("\t.short\t%d\n", (int)best_idx[i]);

Or (better) you could use %u instead of %d to print the unsigned int value.

>  	printf("\n");
>  }
>  

-- 
~Randy