[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unreachable code in mkimagexx (Fwd: New Defects reported by Coverity
From: |
Andrei Borzenkov |
Subject: |
Re: Unreachable code in mkimagexx (Fwd: New Defects reported by Coverity Scan for GRUB) |
Date: |
Mon, 14 Mar 2016 10:01:26 +0300 |
On Sun, Mar 13, 2016 at 10:38 AM, Andrei Borzenkov <address@hidden> 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));
>
>