mtd: rawnand: stm32_fmc2: fix a buffer overflow
The chip select defined in the device tree could only be 0 or 1. Signed-off-by: Christophe Kerello <christophe.kerello@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
This commit is contained in:
		
							parent
							
								
									9a2b0540dc
								
							
						
					
					
						commit
						e99e812e12
					
				| 
						 | 
					@ -846,7 +846,7 @@ static int stm32_fmc2_parse_child(struct stm32_fmc2_nfc *fmc2,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < nand->ncs; i++) {
 | 
						for (i = 0; i < nand->ncs; i++) {
 | 
				
			||||||
		if (cs[i] > FMC2_MAX_CE) {
 | 
							if (cs[i] >= FMC2_MAX_CE) {
 | 
				
			||||||
			pr_err("Invalid reg value: %d\n",
 | 
								pr_err("Invalid reg value: %d\n",
 | 
				
			||||||
			       nand->cs_used[i]);
 | 
								       nand->cs_used[i]);
 | 
				
			||||||
			return -EINVAL;
 | 
								return -EINVAL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue