patchlwIP - A Lightweight TCP/IP stack - Patches: patch #10155, cleanup for static code checker in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #10155: cleanup for static code checker in tcp_in.c

Submitter:  Florian La Roche <flaroche>
Submitted:  Tue 07 Dec 2021 08:11:44 AM UTC
   
 
Category:  TCP Priority:  3 - Low
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Planned Release:  None

Fri 14 Jan 2022 02:36:58 PM UTC, comment #4: 

The code checker is Klocwork. I'll keep this change
within our local changes. Ok to close this here.

best regards from Germany,

Florian La Roche

Florian La Roche <flaroche>
Thu 30 Dec 2021 09:22:00 PM UTC, comment #3: 

I'm tempted to close this as invalid (as I haven't seen this change make any difference with gcc or clang warnings), but could you please share the name of the code checker that issues this warning before I close this?

Simon Goldschmidt <goldsimon>
Group administrator
Tue 07 Dec 2021 02:30:46 PM UTC, comment #2: 

The warning says: "Operands in a bitwise operation have different size." And the warning is gone with the patch applied.

The non-shortcut version does not give any warnings. I assume this
is due to the promotion to 'int', so then the question is only if
the final assignment should give some warning (which wouldn't make any sense.)

Not sure what the best resolution is. I am fine with any decision,
also just closing this bug-report with keeping source unchanged.

best regards,

Florian La Roche

Florian La Roche <flaroche>
Tue 07 Dec 2021 01:52:58 PM UTC, comment #1: 

I'm curious, what kind of code checker is this? And what's the exact message? Is it satisfied after applying that patch?

I'm not aware of the code being a problem. What I do know is that per C standard, a line like

some_uint16_t |= some_uint8_t;

can give warnings because you downsize a result, because this is effectively a shortcut for

some_uint16_t = (some_uint16_t | some_uint8_t);

where the right hand side is promoted to 'int' after the '|' operator.

I don't know what would be wrong with ORing an uint16_t and an uint8_t, though. Does the "non-shortcut" version produce the same warning in your code checker?

Simon Goldschmidt <goldsimon>
Group administrator
Tue 07 Dec 2021 08:11:44 AM UTC, original submission:  

Some static code checker warns for tcp_in.c to have a
u16_t on the left side and a smaller int on the right side.

best regards and thanks for lwip,

Florian La Roche

Florian La Roche <flaroche>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #52446:  lwip-tcp_in.patch added by flaroche (582B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by flaroche (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-12-07 flaroche Attached File- Added lwip-tcp_in.patch, #52446

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code