Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
com32: Handle broken modules.alias
When parsing the modules.alias, we shall report it as broken if we
cannot find any valid line in it.

This patch simply count the number of valid lines and report a missing
modules.alias if no valid lines are found.
  • Loading branch information
ErwanAliasr1 authored and geneC committed Dec 6, 2015
1 parent 7d70885 commit a35e34b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions com32/lib/pci/scan.c
Expand Up @@ -603,6 +603,7 @@ int get_module_name_from_alias(struct pci_domain *domain, char *modules_alias_pa
char sub_product_id[16];
FILE *f;
struct pci_device *dev=NULL;
int valid_lines=0;

/* Intializing the linux_kernel_module for each pci device to "unknown" */
/* adding a dev_info member if needed */
Expand Down Expand Up @@ -630,6 +631,7 @@ int get_module_name_from_alias(struct pci_domain *domain, char *modules_alias_pa
if ((line[0] == '#') || (strstr(line,"alias pci:v")==NULL))
continue;

valid_lines++;
/* Resetting temp buffer*/
memset(module_name,0,sizeof(module_name));
memset(vendor_id,0,sizeof(vendor_id));
Expand Down Expand Up @@ -725,5 +727,11 @@ int get_module_name_from_alias(struct pci_domain *domain, char *modules_alias_pa
}
}
fclose(f);
/* If no valid line was found in the module.alias,
* we shall report it as broken/empty/non-existing */
if (valid_lines == 0) {
return -ENOMODULESALIAS;
}

return 0;
}

0 comments on commit a35e34b

Please sign in to comment.