Skip to content

Fix some Infer Dead Store warnings#783

Open
fabio-porcedda wants to merge 1 commit intorhboot:mainfrom
fabio-porcedda:infer
Open

Fix some Infer Dead Store warnings#783
fabio-porcedda wants to merge 1 commit intorhboot:mainfrom
fabio-porcedda:infer

Conversation

@fabio-porcedda
Copy link
Contributor

Fix some Dead Store warnings found by the Infer static analysis tool:

csv.c:53: error: Dead Store
The value written to &efi_status is never used.
51. parse_csv_data(char *data, char *data_end, size_t n_columns, list_t *list)
52. {
53. EFI_STATUS efi_status = EFI_OUT_OF_RESOURCES; ^
54. char delims[] = "\r\n";
55. char *line = data;

fallback.c:71: error: Dead Store
The value written to &dp is never used.
69. EFI_DEVICE_PATH **Out)
70. {
71. EFI_DEVICE_PATH *dp = In; ^
72. if (!In || !Out)
73. return EFI_INVALID_PARAMETER;

post-process-pe.c:125: error: Dead Store
The value written to &PEHdr is never used.
123. {
124. EFI_IMAGE_DOS_HEADER *DOSHdr = data;
125. EFI_IMAGE_OPTIONAL_HEADER_UNION *PEHdr = data; ^
126. size_t HeaderWithoutDataDir, SectionHeaderOffset, OptHeaderSize;
127. size_t FileAlignment = 0;

post-process-pe.c:393: error: Dead Store
The value written to &Section is never used.
391. } 392.
393. Section = ctx->FirstSection; ^
394. for (i=0, Section = ctx->FirstSection; i < ctx->NumberOfSections; i++, Section++) {
395. debug(NOISE, "Section %d has WRITE=%d and EXECUTE=%d\n", i,

Fix some Dead Store warnings found by the Infer static analysis tool:

csv.c:53: error: Dead Store
  The value written to `&efi_status` is never used.
  51. parse_csv_data(char *data, char *data_end, size_t n_columns, list_t *list)
  52. {
  53. 	EFI_STATUS efi_status = EFI_OUT_OF_RESOURCES;
       ^
  54. 	char delims[] = "\r\n";
  55. 	char *line = data;

fallback.c:71: error: Dead Store
  The value written to `&dp` is never used.
  69. 		  EFI_DEVICE_PATH **Out)
  70. {
  71. 	EFI_DEVICE_PATH *dp = In;
       ^
  72. 	if (!In || !Out)
  73. 		return EFI_INVALID_PARAMETER;

post-process-pe.c:125: error: Dead Store
  The value written to `&PEHdr` is never used.
  123. {
  124. 	EFI_IMAGE_DOS_HEADER *DOSHdr = data;
  125. 	EFI_IMAGE_OPTIONAL_HEADER_UNION *PEHdr = data;
        ^
  126. 	size_t HeaderWithoutDataDir, SectionHeaderOffset, OptHeaderSize;
  127. 	size_t FileAlignment = 0;

post-process-pe.c:393: error: Dead Store
  The value written to `&Section` is never used.
  391. 	}
  392.
  393. 	Section = ctx->FirstSection;
        ^
  394. 	for (i=0, Section = ctx->FirstSection; i < ctx->NumberOfSections; i++, Section++) {
  395. 		debug(NOISE, "Section %d has WRITE=%d and EXECUTE=%d\n", i,

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
EFI_STATUS
parse_csv_data(char *data, char *data_end, size_t n_columns, list_t *list)
{
EFI_STATUS efi_status = EFI_OUT_OF_RESOURCES;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather remove the assignment later and leave it with a "default" error code; if code gets added later that'll ensure it's not returned uninitialized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants