diff mbox series

[1/1] xen/common: Remove dead code

Message ID 20241218233659.573195-3-Ariel.Otilibili-Anieli@eurecom.fr (mailing list archive)
State New
Headers show
Series xen/common: Remove dead code | expand

Commit Message

Ariel Otilibili-Anieli Dec. 18, 2024, 11:34 p.m. UTC
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.")
Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
--
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Anthony PERARD <anthony.perard@vates.tech>
Cc: Michal Orzel <michal.orzel@amd.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien@xen.org>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/gzip/inflate.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Jan Beulich Dec. 19, 2024, 8:32 a.m. UTC | #1
On 19.12.2024 00:34, Ariel Otilibili wrote:
> 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.")
> Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>

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
Ariel Otilibili-Anieli Dec. 19, 2024, 9:10 a.m. UTC | #2
On Thursday, December 19, 2024 09:32 CET, Jan Beulich <jbeulich@suse.com> wrote:

> On 19.12.2024 00:34, Ariel Otilibili wrote:
> > 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.")
> > Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
> 
> 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?
> 
> 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.
> 
> Jan
Ariel Otilibili-Anieli Dec. 19, 2024, 9:43 a.m. UTC | #3
On Thursday, December 19, 2024 10:10 CET, "Ariel Otilibili-Anieli" <Ariel.Otilibili-Anieli@eurecom.fr> wrote:

> On Thursday, December 19, 2024 09:32 CET, Jan Beulich <jbeulich@suse.com> wrote:
> 
> > On 19.12.2024 00:34, Ariel Otilibili wrote:
> > > 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.")
> > > Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
> > 
> > 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?
> > 
> > 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.

The patch sent to Linux,
https://lore.kernel.org/lkml/20241219092615.644642-1-ariel.otilibili-anieli@eurecom.fr/
> > 
> > Jan
diff mbox series

Patch

diff --git a/xen/common/gzip/inflate.c b/xen/common/gzip/inflate.c
index b9a2d7a23a..cb146555c8 100644
--- a/xen/common/gzip/inflate.c
+++ b/xen/common/gzip/inflate.c
@@ -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;