Changeset fe18d4a75a7c5281188bff42c2bdbc53f1ec9ee8
- Timestamp:
- 11/09/09 09:42:10 (2 years ago)
- Author:
- Erwan Velu <erwan.velu@…>
- Children:
- 590f9d031162dd2377980c4daadff7cc85cdff02
- Parents:
- 2adc666fb9ef812bcd7d509b2501ccaab00c4c22
- git-committer:
- Erwan Velu <erwan.velu@free.fr> / 2009-11-09T10:42:10Z+0100
- Message:
-
pci: Prevent kernel modules to be listed twice
Impact: Prevent duplicated modules
If both get_module_name_from_pcimap() & get_module_name_from_alias()
are called, we didn't checked if the module we are detecting already got
detected. This leads to a situation where modules got listed twice.
This patch add a test to insure that we aren't adding an already
detected module.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r0b19ab
|
rfe18d4
|
|
| 155 | 155 | (int_sub_vendor_id & dev->sub_vendor) |
| 156 | 156 | == dev->sub_vendor) { |
| 157 | | strcpy(dev->dev_info->linux_kernel_module[dev->dev_info->linux_kernel_module_count], module_name); |
| 158 | | dev->dev_info->linux_kernel_module_count++; |
| | 157 | bool found=false; |
| | 158 | |
| | 159 | /* Scan all known kernel modules for this pci device */ |
| | 160 | for (int i=0; i<dev->dev_info->linux_kernel_module_count; i++) { |
| | 161 | |
| | 162 | /* Try to detect if we already knew the same kernel module*/ |
| | 163 | if (strstr(dev->dev_info->linux_kernel_module[i], module_name)) { |
| | 164 | found=true; |
| | 165 | break; |
| | 166 | } |
| | 167 | } |
| | 168 | /* If we don't have this kernel module, let's add it */ |
| | 169 | if (!found) { |
| | 170 | strcpy(dev->dev_info->linux_kernel_module[dev->dev_info->linux_kernel_module_count], module_name); |
| | 171 | dev->dev_info->linux_kernel_module_count++; |
| | 172 | } |
| 159 | 173 | } |
| 160 | 174 | } |
| … |
… |
|
| 703 | 717 | (int_sub_vendor_id & dev->sub_vendor) |
| 704 | 718 | == dev->sub_vendor) { |
| 705 | | strcpy(dev->dev_info->linux_kernel_module[dev->dev_info->linux_kernel_module_count], module_name); |
| 706 | | dev->dev_info->linux_kernel_module_count++; |
| | 719 | bool found=false; |
| | 720 | |
| | 721 | /* Scan all known kernel modules for this pci device */ |
| | 722 | for (int i=0; i<dev->dev_info->linux_kernel_module_count; i++) { |
| | 723 | |
| | 724 | /* Try to detect if we already knew the same kernel module*/ |
| | 725 | if (strstr(dev->dev_info->linux_kernel_module[i], module_name)) { |
| | 726 | found=true; |
| | 727 | break; |
| | 728 | } |
| | 729 | } |
| | 730 | /* If we don't have this kernel module, let's add it */ |
| | 731 | if (!found) { |
| | 732 | strcpy(dev->dev_info->linux_kernel_module[dev->dev_info->linux_kernel_module_count], module_name); |
| | 733 | dev->dev_info->linux_kernel_module_count++; |
| | 734 | } |
| 707 | 735 | } |
| 708 | 736 | } |