grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* Unreachable code in mkimagexx (Fwd: New Defects reported by Coverity Scan for GRUB)
       [not found] <56e50bb23d7a8_5d6aabd33094490@ss1435.mail>
@ 2016-03-13  7:38 ` Andrei Borzenkov
  2016-03-14  7:01   ` Andrei Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Borzenkov @ 2016-03-13  7:38 UTC (permalink / raw)
  To: The development of GNU GRUB


We probably need to #ifdef this section for MKIMAGE_ELF64 case only, it
makes no sense to compile it for 32 bit target.

________________________________________________________________________________________________________
*** CID 158599:    (DEADCODE)
/util/grub-mkimagexx.c: 1317 in translate_relocation_pe()
1311     	  break;
1312     	}
1313           break;
1314         case EM_AARCH64:
1315           switch (ELF_R_TYPE (info))
1316     	{
>>>     CID 158599:    (DEADCODE)
>>>     Execution cannot reach this statement: "case 257U:".
1317     	case R_AARCH64_ABS64:
1318     	  {
1319     	    ctx->current_address
1320     	      = add_fixup_entry (&ctx->lst,
1321     				 GRUB_PE32_REL_BASED_DIR64,
1322     				 addr, 0, ctx->current_address,
/util/grub-mkimagexx.c: 1331 in translate_relocation_pe()
1325     	  break;
1326     	  /* Relative relocations do not require fixup entries. */
1327     	case R_AARCH64_CALL26:
1328     	case R_AARCH64_JUMP26:
1329     	  break;
1330     	  /* Page-relative relocations do not require fixup entries. */
>>>     CID 158599:    (DEADCODE)
>>>     Execution cannot reach this statement: "case 275U:".
1331     	case R_AARCH64_ADR_PREL_PG_HI21:
1332     	  /* We page-align the whole kernel, so no need
1333     	     for fixup entries.
1334     	  */
1335     	case R_AARCH64_ADD_ABS_LO12_NC:
1336     	case R_AARCH64_LDST64_ABS_LO12_NC:
/util/grub-mkimagexx.c: 1335 in translate_relocation_pe()
1329     	  break;
1330     	  /* Page-relative relocations do not require fixup entries. */
1331     	case R_AARCH64_ADR_PREL_PG_HI21:
1332     	  /* We page-align the whole kernel, so no need
1333     	     for fixup entries.
1334     	  */
>>>     CID 158599:    (DEADCODE)
>>>     Execution cannot reach this statement: "case 277U:".
1335     	case R_AARCH64_ADD_ABS_LO12_NC:
1336     	case R_AARCH64_LDST64_ABS_LO12_NC:
1337     	  break;
1338
1339     	default:
1340     	  grub_util_error (_("relocation 0x%x is not implemented yet"),
/util/grub-mkimagexx.c: 1328 in translate_relocation_pe()
1322     				 addr, 0, ctx->current_address,
1323     				 image_target);
1324     	  }
1325     	  break;
1326     	  /* Relative relocations do not require fixup entries. */
1327     	case R_AARCH64_CALL26:
>>>     CID 158599:    (DEADCODE)
>>>     Execution cannot reach this statement: "case 282U:".
1328     	case R_AARCH64_JUMP26:
1329     	  break;
1330     	  /* Page-relative relocations do not require fixup entries. */
1331     	case R_AARCH64_ADR_PREL_PG_HI21:
1332     	  /* We page-align the whole kernel, so no need
1333     	     for fixup entries.
/util/grub-mkimagexx.c: 1327 in translate_relocation_pe()
1321     				 GRUB_PE32_REL_BASED_DIR64,
1322     				 addr, 0, ctx->current_address,
1323     				 image_target);
1324     	  }
1325     	  break;
1326     	  /* Relative relocations do not require fixup entries. */
>>>     CID 158599:    (DEADCODE)
>>>     Execution cannot reach this statement: "case 283U:".
1327     	case R_AARCH64_CALL26:
1328     	case R_AARCH64_JUMP26:
1329     	  break;
1330     	  /* Page-relative relocations do not require fixup entries. */
1331     	case R_AARCH64_ADR_PREL_PG_HI21:
1332     	  /* We page-align the whole kernel, so no need
/util/grub-mkimagexx.c: 1336 in translate_relocation_pe()
1330     	  /* Page-relative relocations do not require fixup entries. */
1331     	case R_AARCH64_ADR_PREL_PG_HI21:
1332     	  /* We page-align the whole kernel, so no need
1333     	     for fixup entries.
1334     	  */
1335     	case R_AARCH64_ADD_ABS_LO12_NC:
>>>     CID 158599:    (DEADCODE)
>>>     Execution cannot reach this statement: "case 286U:".
1336     	case R_AARCH64_LDST64_ABS_LO12_NC:
1337     	  break;
1338
1339     	default:
1340     	  grub_util_error (_("relocation 0x%x is not implemented yet"),
1341     			   (unsigned int) ELF_R_TYPE (info));




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Unreachable code in mkimagexx (Fwd: New Defects reported by Coverity Scan for GRUB)
  2016-03-13  7:38 ` Unreachable code in mkimagexx (Fwd: New Defects reported by Coverity Scan for GRUB) Andrei Borzenkov
@ 2016-03-14  7:01   ` Andrei Borzenkov
  2017-01-24  1:51     ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Borzenkov @ 2016-03-14  7:01 UTC (permalink / raw)
  To: The development of GNU GRUB

On Sun, Mar 13, 2016 at 10:38 AM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>
> We probably need to #ifdef this section for MKIMAGE_ELF64 case only, it
> makes no sense to compile it for 32 bit target.
>

Hmm ... why translate_relocation_pe, translate_relocation_raw and
classify_raw_reloc are not target size specific in the first place?
They take Elf_Addr parameters so cannot work for both 32 and 64 bit
targets at the same time.




> ________________________________________________________________________________________________________
> *** CID 158599:    (DEADCODE)
> /util/grub-mkimagexx.c: 1317 in translate_relocation_pe()
> 1311              break;
> 1312            }
> 1313           break;
> 1314         case EM_AARCH64:
> 1315           switch (ELF_R_TYPE (info))
> 1316            {
>>>>     CID 158599:    (DEADCODE)
>>>>     Execution cannot reach this statement: "case 257U:".
> 1317            case R_AARCH64_ABS64:
> 1318              {
> 1319                ctx->current_address
> 1320                  = add_fixup_entry (&ctx->lst,
> 1321                                     GRUB_PE32_REL_BASED_DIR64,
> 1322                                     addr, 0, ctx->current_address,
> /util/grub-mkimagexx.c: 1331 in translate_relocation_pe()
> 1325              break;
> 1326              /* Relative relocations do not require fixup entries. */
> 1327            case R_AARCH64_CALL26:
> 1328            case R_AARCH64_JUMP26:
> 1329              break;
> 1330              /* Page-relative relocations do not require fixup entries. */
>>>>     CID 158599:    (DEADCODE)
>>>>     Execution cannot reach this statement: "case 275U:".
> 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> 1332              /* We page-align the whole kernel, so no need
> 1333                 for fixup entries.
> 1334              */
> 1335            case R_AARCH64_ADD_ABS_LO12_NC:
> 1336            case R_AARCH64_LDST64_ABS_LO12_NC:
> /util/grub-mkimagexx.c: 1335 in translate_relocation_pe()
> 1329              break;
> 1330              /* Page-relative relocations do not require fixup entries. */
> 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> 1332              /* We page-align the whole kernel, so no need
> 1333                 for fixup entries.
> 1334              */
>>>>     CID 158599:    (DEADCODE)
>>>>     Execution cannot reach this statement: "case 277U:".
> 1335            case R_AARCH64_ADD_ABS_LO12_NC:
> 1336            case R_AARCH64_LDST64_ABS_LO12_NC:
> 1337              break;
> 1338
> 1339            default:
> 1340              grub_util_error (_("relocation 0x%x is not implemented yet"),
> /util/grub-mkimagexx.c: 1328 in translate_relocation_pe()
> 1322                                     addr, 0, ctx->current_address,
> 1323                                     image_target);
> 1324              }
> 1325              break;
> 1326              /* Relative relocations do not require fixup entries. */
> 1327            case R_AARCH64_CALL26:
>>>>     CID 158599:    (DEADCODE)
>>>>     Execution cannot reach this statement: "case 282U:".
> 1328            case R_AARCH64_JUMP26:
> 1329              break;
> 1330              /* Page-relative relocations do not require fixup entries. */
> 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> 1332              /* We page-align the whole kernel, so no need
> 1333                 for fixup entries.
> /util/grub-mkimagexx.c: 1327 in translate_relocation_pe()
> 1321                                     GRUB_PE32_REL_BASED_DIR64,
> 1322                                     addr, 0, ctx->current_address,
> 1323                                     image_target);
> 1324              }
> 1325              break;
> 1326              /* Relative relocations do not require fixup entries. */
>>>>     CID 158599:    (DEADCODE)
>>>>     Execution cannot reach this statement: "case 283U:".
> 1327            case R_AARCH64_CALL26:
> 1328            case R_AARCH64_JUMP26:
> 1329              break;
> 1330              /* Page-relative relocations do not require fixup entries. */
> 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> 1332              /* We page-align the whole kernel, so no need
> /util/grub-mkimagexx.c: 1336 in translate_relocation_pe()
> 1330              /* Page-relative relocations do not require fixup entries. */
> 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> 1332              /* We page-align the whole kernel, so no need
> 1333                 for fixup entries.
> 1334              */
> 1335            case R_AARCH64_ADD_ABS_LO12_NC:
>>>>     CID 158599:    (DEADCODE)
>>>>     Execution cannot reach this statement: "case 286U:".
> 1336            case R_AARCH64_LDST64_ABS_LO12_NC:
> 1337              break;
> 1338
> 1339            default:
> 1340              grub_util_error (_("relocation 0x%x is not implemented yet"),
> 1341                               (unsigned int) ELF_R_TYPE (info));
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Unreachable code in mkimagexx (Fwd: New Defects reported by Coverity Scan for GRUB)
  2016-03-14  7:01   ` Andrei Borzenkov
@ 2017-01-24  1:51     ` Vladimir 'phcoder' Serbinenko
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2017-01-24  1:51 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 5477 bytes --]

They're used only for arm (32-bit). So they don't need to work for 64-bit.

On Mon, 14 Mar 2016, 10:01 Andrei Borzenkov <arvidjaar@gmail.com> wrote:

> On Sun, Mar 13, 2016 at 10:38 AM, Andrei Borzenkov <arvidjaar@gmail.com>
> wrote:
> >
> > We probably need to #ifdef this section for MKIMAGE_ELF64 case only, it
> > makes no sense to compile it for 32 bit target.
> >
>
> Hmm ... why translate_relocation_pe, translate_relocation_raw and
> classify_raw_reloc are not target size specific in the first place?
> They take Elf_Addr parameters so cannot work for both 32 and 64 bit
> targets at the same time.
>
>
>
>
> >
> ________________________________________________________________________________________________________
> > *** CID 158599:    (DEADCODE)
> > /util/grub-mkimagexx.c: 1317 in translate_relocation_pe()
> > 1311              break;
> > 1312            }
> > 1313           break;
> > 1314         case EM_AARCH64:
> > 1315           switch (ELF_R_TYPE (info))
> > 1316            {
> >>>>     CID 158599:    (DEADCODE)
> >>>>     Execution cannot reach this statement: "case 257U:".
> > 1317            case R_AARCH64_ABS64:
> > 1318              {
> > 1319                ctx->current_address
> > 1320                  = add_fixup_entry (&ctx->lst,
> > 1321                                     GRUB_PE32_REL_BASED_DIR64,
> > 1322                                     addr, 0, ctx->current_address,
> > /util/grub-mkimagexx.c: 1331 in translate_relocation_pe()
> > 1325              break;
> > 1326              /* Relative relocations do not require fixup entries.
> */
> > 1327            case R_AARCH64_CALL26:
> > 1328            case R_AARCH64_JUMP26:
> > 1329              break;
> > 1330              /* Page-relative relocations do not require fixup
> entries. */
> >>>>     CID 158599:    (DEADCODE)
> >>>>     Execution cannot reach this statement: "case 275U:".
> > 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> > 1332              /* We page-align the whole kernel, so no need
> > 1333                 for fixup entries.
> > 1334              */
> > 1335            case R_AARCH64_ADD_ABS_LO12_NC:
> > 1336            case R_AARCH64_LDST64_ABS_LO12_NC:
> > /util/grub-mkimagexx.c: 1335 in translate_relocation_pe()
> > 1329              break;
> > 1330              /* Page-relative relocations do not require fixup
> entries. */
> > 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> > 1332              /* We page-align the whole kernel, so no need
> > 1333                 for fixup entries.
> > 1334              */
> >>>>     CID 158599:    (DEADCODE)
> >>>>     Execution cannot reach this statement: "case 277U:".
> > 1335            case R_AARCH64_ADD_ABS_LO12_NC:
> > 1336            case R_AARCH64_LDST64_ABS_LO12_NC:
> > 1337              break;
> > 1338
> > 1339            default:
> > 1340              grub_util_error (_("relocation 0x%x is not implemented
> yet"),
> > /util/grub-mkimagexx.c: 1328 in translate_relocation_pe()
> > 1322                                     addr, 0, ctx->current_address,
> > 1323                                     image_target);
> > 1324              }
> > 1325              break;
> > 1326              /* Relative relocations do not require fixup entries.
> */
> > 1327            case R_AARCH64_CALL26:
> >>>>     CID 158599:    (DEADCODE)
> >>>>     Execution cannot reach this statement: "case 282U:".
> > 1328            case R_AARCH64_JUMP26:
> > 1329              break;
> > 1330              /* Page-relative relocations do not require fixup
> entries. */
> > 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> > 1332              /* We page-align the whole kernel, so no need
> > 1333                 for fixup entries.
> > /util/grub-mkimagexx.c: 1327 in translate_relocation_pe()
> > 1321                                     GRUB_PE32_REL_BASED_DIR64,
> > 1322                                     addr, 0, ctx->current_address,
> > 1323                                     image_target);
> > 1324              }
> > 1325              break;
> > 1326              /* Relative relocations do not require fixup entries.
> */
> >>>>     CID 158599:    (DEADCODE)
> >>>>     Execution cannot reach this statement: "case 283U:".
> > 1327            case R_AARCH64_CALL26:
> > 1328            case R_AARCH64_JUMP26:
> > 1329              break;
> > 1330              /* Page-relative relocations do not require fixup
> entries. */
> > 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> > 1332              /* We page-align the whole kernel, so no need
> > /util/grub-mkimagexx.c: 1336 in translate_relocation_pe()
> > 1330              /* Page-relative relocations do not require fixup
> entries. */
> > 1331            case R_AARCH64_ADR_PREL_PG_HI21:
> > 1332              /* We page-align the whole kernel, so no need
> > 1333                 for fixup entries.
> > 1334              */
> > 1335            case R_AARCH64_ADD_ABS_LO12_NC:
> >>>>     CID 158599:    (DEADCODE)
> >>>>     Execution cannot reach this statement: "case 286U:".
> > 1336            case R_AARCH64_LDST64_ABS_LO12_NC:
> > 1337              break;
> > 1338
> > 1339            default:
> > 1340              grub_util_error (_("relocation 0x%x is not implemented
> yet"),
> > 1341                               (unsigned int) ELF_R_TYPE (info));
> >
> >
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #2: Type: text/html, Size: 9466 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-24  1:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <56e50bb23d7a8_5d6aabd33094490@ss1435.mail>
2016-03-13  7:38 ` Unreachable code in mkimagexx (Fwd: New Defects reported by Coverity Scan for GRUB) Andrei Borzenkov
2016-03-14  7:01   ` Andrei Borzenkov
2017-01-24  1:51     ` Vladimir 'phcoder' Serbinenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).