Skip to contentSkip to conversation

nand: Fix set_dev checks for no device

PATCH New Tony Lindgren 2 participants 2 messages Aug 24, 2016 – Aug 29, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 nand: Fix set_dev checks for no device

If we do nand device 0 command in u-boot on a device that has NAND support enabled but no NAND chip, we can get data abort at least on omaps.

Fix the issue by replacing the check with nand_info[dev] as suggested by Scott Wood. The check for name existed before because before the array-to-pointer conversion there was no way to directly test nand_info[dev] for emptiness.

cmd/nand.c +1 -2
@@ -115,8 +115,7 @@ free_dat:
 
 static int set_dev(int dev)
 {
-	if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE ||
-	    !nand_info[dev]->name) {
+	if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[dev]) {
 		puts("No such device\n");
 		return -1;
 	}
#1 lore raw

PATCH v3 1/1 nand: Fix set_dev checks for no device

cmd/nand.c

Quoted 11 lines · Tony Lindgren

If we do nand device 0 command in u-boot on a device that has NAND support enabled but no NAND chip, we can get data abort at least on omaps.

Fix the issue by replacing the check with nand_info[dev] as suggested by Scott Wood. The check for name existed before because before the array-to-pointer conversion there was no way to directly test nand_info[dev] for emptiness.

cmd/nand.c +0 -0

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160829/ba41bf4f/attachment.sig>