diff mbox series

[ovs-dev,1/2] netdev-linux: Fix using uninitialized current_speed.

Message ID 20240527110033.531720-1-roid@nvidia.com
State Superseded
Headers show
Series [ovs-dev,1/2] netdev-linux: Fix using uninitialized current_speed. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Roi Dayan May 27, 2024, 11 a.m. UTC
Used Ubuntu with gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
lib/netdev-linux.c:4985:54: error: ‘current_speed’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Fixes: b8f8fad86435 ("netdev-linux: Use speed as max rate in tc classes.")
Signed-off-by: Roi Dayan <roid@nvidia.com>
---
 lib/netdev-linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ilya Maximets May 27, 2024, 12:44 p.m. UTC | #1
On 5/27/24 13:00, Roi Dayan via dev wrote:
> Used Ubuntu with gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
> lib/netdev-linux.c:4985:54: error: ‘current_speed’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> Fixes: b8f8fad86435 ("netdev-linux: Use speed as max rate in tc classes.")
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> ---
>  lib/netdev-linux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> index 25349c605cdb..0cb379295af1 100644
> --- a/lib/netdev-linux.c
> +++ b/lib/netdev-linux.c
> @@ -4957,7 +4957,7 @@ htb_parse_qdisc_details__(struct netdev *netdev, const struct smap *details,
>  {
>      hc->max_rate = smap_get_ullong(details, "max-rate", 0) / 8;
>      if (!hc->max_rate) {
> -        uint32_t current_speed;
> +        uint32_t current_speed = 0;
>          uint32_t max_speed OVS_UNUSED;
>  
>          netdev_linux_get_speed_locked(netdev_linux_cast(netdev),
> @@ -5429,7 +5429,7 @@ hfsc_parse_qdisc_details__(struct netdev *netdev, const struct smap *details,
>  {
>      uint32_t max_rate = smap_get_ullong(details, "max-rate", 0) / 8;
>      if (!max_rate) {
> -        uint32_t current_speed;
> +        uint32_t current_speed = 0;
>          uint32_t max_speed OVS_UNUSED;
>  
>          netdev_linux_get_speed_locked(netdev_linux_cast(netdev),

Hi, Roi.  Thanks for the patch!

I think it is trying to fix the same issue as:
  https://patchwork.ozlabs.org/project/openvswitch/patch/20240523191152.589605-6-mkp@redhat.com/

Best regards, Ilya Maximets.
Roi Dayan May 27, 2024, 1:58 p.m. UTC | #2
On 27/05/2024 15:44, Ilya Maximets wrote:
> On 5/27/24 13:00, Roi Dayan via dev wrote:
>> Used Ubuntu with gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
>> lib/netdev-linux.c:4985:54: error: ‘current_speed’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>
>> Fixes: b8f8fad86435 ("netdev-linux: Use speed as max rate in tc classes.")
>> Signed-off-by: Roi Dayan <roid@nvidia.com>
>> ---
>>  lib/netdev-linux.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
>> index 25349c605cdb..0cb379295af1 100644
>> --- a/lib/netdev-linux.c
>> +++ b/lib/netdev-linux.c
>> @@ -4957,7 +4957,7 @@ htb_parse_qdisc_details__(struct netdev *netdev, const struct smap *details,
>>  {
>>      hc->max_rate = smap_get_ullong(details, "max-rate", 0) / 8;
>>      if (!hc->max_rate) {
>> -        uint32_t current_speed;
>> +        uint32_t current_speed = 0;
>>          uint32_t max_speed OVS_UNUSED;
>>  
>>          netdev_linux_get_speed_locked(netdev_linux_cast(netdev),
>> @@ -5429,7 +5429,7 @@ hfsc_parse_qdisc_details__(struct netdev *netdev, const struct smap *details,
>>  {
>>      uint32_t max_rate = smap_get_ullong(details, "max-rate", 0) / 8;
>>      if (!max_rate) {
>> -        uint32_t current_speed;
>> +        uint32_t current_speed = 0;
>>          uint32_t max_speed OVS_UNUSED;
>>  
>>          netdev_linux_get_speed_locked(netdev_linux_cast(netdev),
> 
> Hi, Roi.  Thanks for the patch!
> 
> I think it is trying to fix the same issue as:
>   https://patchwork.ozlabs.org/project/openvswitch/patch/20240523191152.589605-6-mkp@redhat.com/
> 
> Best regards, Ilya Maximets.

right. thanks!
diff mbox series

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 25349c605cdb..0cb379295af1 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -4957,7 +4957,7 @@  htb_parse_qdisc_details__(struct netdev *netdev, const struct smap *details,
 {
     hc->max_rate = smap_get_ullong(details, "max-rate", 0) / 8;
     if (!hc->max_rate) {
-        uint32_t current_speed;
+        uint32_t current_speed = 0;
         uint32_t max_speed OVS_UNUSED;
 
         netdev_linux_get_speed_locked(netdev_linux_cast(netdev),
@@ -5429,7 +5429,7 @@  hfsc_parse_qdisc_details__(struct netdev *netdev, const struct smap *details,
 {
     uint32_t max_rate = smap_get_ullong(details, "max-rate", 0) / 8;
     if (!max_rate) {
-        uint32_t current_speed;
+        uint32_t current_speed = 0;
         uint32_t max_speed OVS_UNUSED;
 
         netdev_linux_get_speed_locked(netdev_linux_cast(netdev),