diff options
author | Aparna Mallavarapu <aparnam@codeaurora.org> | 2013-04-08 21:44:51 +0530 |
---|---|---|
committer | Aparna Mallavarapu <aparnam@codeaurora.org> | 2013-04-08 21:54:32 +0530 |
commit | c5946f2624367531051b1118376d3a7b113fbf52 (patch) | |
tree | 7279a9de24e09810f87745c3e0d8bcfafd5a4d39 | |
parent | cc6fad8cddc1394048e7cbc8a3cc23bc9bdf8adf (diff) | |
download | lk-c5946f2624367531051b1118376d3a7b113fbf52.tar.gz |
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
-rw-r--r-- | platform/msm_shared/nand.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/platform/msm_shared/nand.c b/platform/msm_shared/nand.c index fae7fbb5..4030c34d 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 @@ void flash_init(void) 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)) { |