Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

Commit cfbea60

Browse files
committed
gadget: Fix -Woverflow warning
Fixes #8 Signed-off-by: Noralf Trønnes <[email protected]>
1 parent 798079e commit cfbea60

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From da7b96ee6a2553a49195f22f0bf7019e2b199871 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <[email protected]>
3+
Date: Fri, 2 Sep 2022 15:26:49 +0200
4+
Subject: [PATCH] usb/gadget/function/gud: Fix u32 overflow
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
On a 64-bit build:
10+
11+
drivers/usb/gadget/function/f_gud.c: In function ‘f_gud_a lloc_func_inst’:
12+
drivers/usb/gadget/function/f_gud.c:855:21: warning: conversion from ‘long unsigned int’ to ‘u32’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Woverflow]
13+
855 | opts->connectors = ~0UL;
14+
15+
Change to unsigned.
16+
17+
Fixes #8
18+
19+
Signed-off-by: Noralf Trønnes <[email protected]>
20+
---
21+
drivers/usb/gadget/function/f_gud.c | 2 +-
22+
1 file changed, 1 insertion(+), 1 deletion(-)
23+
24+
diff --git a/drivers/usb/gadget/function/f_gud.c b/drivers/usb/gadget/function/f_gud.c
25+
index 0e0e5717c69d..826d5582d6cf 100644
26+
--- a/drivers/usb/gadget/function/f_gud.c
27+
+++ b/drivers/usb/gadget/function/f_gud.c
28+
@@ -852,7 +852,7 @@ static struct usb_function_instance *f_gud_alloc_func_inst(void)
29+
mutex_init(&opts->lock);
30+
opts->func_inst.free_func_inst = f_gud_free_func_inst;
31+
opts->compression = ~0;
32+
- opts->connectors = ~0UL;
33+
+ opts->connectors = ~0U;
34+
35+
config_group_init_type_name(&opts->func_inst.group, "", &f_gud_func_type);
36+
37+
--
38+
2.34.1
39+

0 commit comments

Comments
 (0)