msm_shared: Fix a possible NULL pointer deference in the flash init.
Assert when the flash cmdptr, cmd list, data and spare ptrs are NULL.
CRs-Fixed: 447612
Change-Id: I0ae6983e6d9a73ed5550c495b07f0fb8462fddf7
diff --git a/platform/msm_shared/nand.c b/platform/msm_shared/nand.c
index fae7fbb..4030c34 100644
--- a/platform/msm_shared/nand.c
+++ b/platform/msm_shared/nand.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2008, Google Inc.
* All rights reserved.
- * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -3329,6 +3329,10 @@
flash_data = memalign(32, 4096 + 128);
flash_spare = memalign(32, 128);
+ if (flash_ptrlist == NULL || flash_cmdlist == NULL
+ || flash_data == NULL || flash_spare == NULL)
+ ASSERT(0);
+
flash_read_id(flash_cmdlist, flash_ptrlist);
if ((FLASH_8BIT_NAND_DEVICE == flash_info.type)
|| (FLASH_16BIT_NAND_DEVICE == flash_info.type)) {