Skip to contentSkip to conversation

xen/common: Remove dead code

PATCH In review Ariel Otilibili 3 participants 7 messages Dec 18, 2024 – Jan 10, 2025

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 xen/common: Remove dead code

The if-statement tests res is non-zero; meaning the case zero is never reached.

Coverity-ID: 1055253

Fixes e2b1ebf4de ("x86: Support booting a bzImage format domain 0 kernel.")

--
Cc: Andrew Cooper <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: Michal Orzel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: "Roger Pau Monné" <[email protected]>
Cc: Stefano Stabellini <[email protected]>

---
 xen/common/gzip/inflate.c | 2 --
 1 file changed, 2 deletions(-)
xen/common/gzip/inflate.c +0 -2
index b9a2d7a23a..cb146555c8 100644
@@ -1164,8 +1164,6 @@ static int __init gunzip(struct gunzip_state *s)
     if ( (res = inflate(s)) )
     {
         switch (res) {
-        case 0:
-            break;
         case 1:
             error("invalid compressed format (err=1)");
             break;
Signature · 1 line
2.47.1
#2 lore raw
Quoted 5 lines · Ariel Otilibili

The if-statement tests res is non-zero; meaning the case zero is never reached.

Coverity-ID: 1055253

Fixes e2b1ebf4de ("x86: Support booting a bzImage format domain 0 kernel.")

I certainly agree with the change, especially if Coverity complains about it. In fact I'd expect Eclair to complain too, for this being unreachable or dead code (I'm never sure which one's which in their nomenclature). The Misra violation addressed may therefore want mentioning, too.

However, the commit referenced says "xen/common/inflate.c is taken unmodified from Linux v2.6.28." Therefore the preferred approach would be to correct the original first, then pull in that patch to our tree. (And yes, the code is still as was even in 6.13-rc3.)

Jan

#3 lore raw
Quoted 11 lines · Jan Beulich
Quoted 5 lines · Ariel Otilibili

The if-statement tests res is non-zero; meaning the case zero is never reached.

Coverity-ID: 1055253

Fixes e2b1ebf4de ("x86: Support booting a bzImage format domain 0 kernel.")

I certainly agree with the change, especially if Coverity complains about it. In fact I'd expect Eclair to complain too, for this being unreachable or dead code (I'm never sure which one's which in their nomenclature). The Misra violation addressed may therefore want mentioning, too.

I didn't know Eclair and Miscra could send warnings. Are they commands available for that?

Quoted 5 lines

However, the commit referenced says "xen/common/inflate.c is taken unmodified from Linux v2.6.28." Therefore the preferred approach would be to correct the original first, then pull in that patch to our tree. (And yes, the code is still as was even in 6.13-rc3.)

So old a commit...

This approach makes sense, Jan; thanks for the feedback. I am sending the patch to Linux.

And will keep you posted.

Quoted 2 lines

Jan

#4 lore raw
Quoted 21 lines · Ariel Otilibili-Anieli
Quoted 11 lines · Jan Beulich
Quoted 5 lines · Ariel Otilibili

The if-statement tests res is non-zero; meaning the case zero is never reached.

Coverity-ID: 1055253

Fixes e2b1ebf4de ("x86: Support booting a bzImage format domain 0 kernel.")

I certainly agree with the change, especially if Coverity complains about it. In fact I'd expect Eclair to complain too, for this being unreachable or dead code (I'm never sure which one's which in their nomenclature). The Misra violation addressed may therefore want mentioning, too.

I didn't know Eclair and Miscra could send warnings. Are they commands available for that?

Quoted 5 lines

However, the commit referenced says "xen/common/inflate.c is taken unmodified from Linux v2.6.28." Therefore the preferred approach would be to correct the original first, then pull in that patch to our tree. (And yes, the code is still as was even in 6.13-rc3.)

Quoted 5 lines

So old a commit...

This approach makes sense, Jan; thanks for the feedback. I am sending the patch to Linux.

And will keep you posted.

The patch sent to Linux,
https://lore.kernel.org/lkml/[email protected]/

Quoted 2 lines
Quoted 2 lines

Jan

Reviewed-by on v1 1/1
#5 lore raw
In reply to Ariel Otilibili
Quoted 5 lines · Ariel Otilibili

The if-statement tests res is non-zero; meaning the case zero is never reached.

Coverity-ID: 1055253

Fixes e2b1ebf4de ("x86: Support booting a bzImage format domain 0 kernel.")
Quoted 28 lines

--
Cc: Andrew Cooper <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: Michal Orzel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: "Roger Pau Monné" <[email protected]>
Cc: Stefano Stabellini <[email protected]>

---
 xen/common/gzip/inflate.c | 2 --
 1 file changed, 2 deletions(-)
xen/common/gzip/inflate.c +0 -2
index b9a2d7a23a..cb146555c8 100644
@@ -1164,8 +1164,6 @@ static int __init gunzip(struct gunzip_state *s)
     if ( (res = inflate(s)) )
     {
         switch (res) {
-        case 0:
-            break;
         case 1:
             error("invalid compressed format (err=1)");
             break;
Signature · 1 line
2.47.1
#6 lore raw

Hi Stefano,

Quoted 5 lines · Stefano Stabellini

On Thu, 19 Dec 2024, Ariel Otilibili wrote:

Thanks for having looked into the patch; sorry for the late response, I have had limited access to my mailbox.

I will follow up with an upstream update.

Regards,
Ariel