Fix for broken parsing of memory environment string in pci driver
- unfixed parsing could run away from the the string and fail on a correct string in complete_bars() - it reanables the body of complete_bars()
This commit is contained in:
		
							parent
							
								
									d2c10fb85e
								
							
						
					
					
						commit
						6eebc03f88
					
				@ -1254,9 +1254,8 @@ PRIVATE void complete_bridges()
 | 
				
			|||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
 *				complete_bars				     *
 | 
					 *				complete_bars				     *
 | 
				
			||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
PRIVATE void complete_bars()
 | 
					PRIVATE void complete_bars(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#if 0 
 | 
					 | 
				
			||||||
	int i, j, r, bar_nr, reg;
 | 
						int i, j, r, bar_nr, reg;
 | 
				
			||||||
	u32_t memgap_low, memgap_high, iogap_low, iogap_high, io_high,
 | 
						u32_t memgap_low, memgap_high, iogap_low, iogap_high, io_high,
 | 
				
			||||||
		base, size, v32, diff1, diff2;
 | 
							base, size, v32, diff1, diff2;
 | 
				
			||||||
@ -1273,24 +1272,20 @@ PRIVATE void complete_bars()
 | 
				
			|||||||
	while (*cp != '\0')
 | 
						while (*cp != '\0')
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		base= strtoul(cp, &next, 16);
 | 
							base= strtoul(cp, &next, 16);
 | 
				
			||||||
		if (next == cp || *next != ':')
 | 
							if (!(*next) || next == cp || *next != ':')
 | 
				
			||||||
		{
 | 
								goto bad_mem_string;
 | 
				
			||||||
			printf("PCI: bad memory environment string '%s'\n",
 | 
					 | 
				
			||||||
				memstr);
 | 
					 | 
				
			||||||
			panic(NULL, NULL, NO_NUM);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		cp= next+1;
 | 
							cp= next+1;
 | 
				
			||||||
		size= strtoul(cp, &next, 16);
 | 
							size= strtoul(cp, &next, 16);
 | 
				
			||||||
		if (next == cp || (*next != ',' && *next != '\0'))
 | 
							if (next == cp || (*next != ',' && *next != '\0'))
 | 
				
			||||||
		{
 | 
							if (!*next)
 | 
				
			||||||
			printf("PCI: bad memory environment string '%s'\n",
 | 
								goto bad_mem_string;
 | 
				
			||||||
				memstr);
 | 
					 | 
				
			||||||
			panic(NULL, NULL, NO_NUM);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		cp= next+1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (base+size > memgap_low)
 | 
							if (base+size > memgap_low)
 | 
				
			||||||
			memgap_low= base+size;
 | 
								memgap_low= base+size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (*next)
 | 
				
			||||||
 | 
								cp= next+1;
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	memgap_high= 0xfe000000;	/* Leave space for the CPU (APIC) */
 | 
						memgap_high= 0xfe000000;	/* Leave space for the CPU (APIC) */
 | 
				
			||||||
@ -1473,7 +1468,11 @@ PRIVATE void complete_bars()
 | 
				
			|||||||
			printf("should allocate resources for device %d\n", i);
 | 
								printf("should allocate resources for device %d\n", i);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
						return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bad_mem_string:
 | 
				
			||||||
 | 
						printf("PCI: bad memory environment string '%s'\n", memstr);
 | 
				
			||||||
 | 
						panic(NULL, NULL, NO_NUM);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user