Several MTD FLASH drivers nullify the freed 'priv' structure and failed to return NULL as stated in the comments. Result, will operate on a NULL pointer later. Noted by David Sidrane.

This commit is contained in:
Gregory Nutt 2016-06-30 17:49:53 -06:00
parent bde90de12f
commit 5b6fafb3f5
8 changed files with 8 additions and 9 deletions

View File

@ -673,7 +673,7 @@ FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev)
ferr("ERROR: Unrecognized\n");
kmm_free(priv);
priv = NULL;
return NULL;
}
else
{

View File

@ -978,7 +978,7 @@ FAR struct mtd_dev_s *is25xp_initialize(FAR struct spi_dev_s *dev)
ferr("ERROR: Unrecognized\n");
kmm_free(priv);
priv = NULL;
return NULL;
}
else
{
@ -999,4 +999,3 @@ FAR struct mtd_dev_s *is25xp_initialize(FAR struct spi_dev_s *dev)
finfo("Return %p\n", priv);
return (FAR struct mtd_dev_s *)priv;
}

View File

@ -1033,7 +1033,7 @@ FAR struct mtd_dev_s *m25p_initialize(FAR struct spi_dev_s *dev)
ferr("ERROR: Unrecognized\n");
kmm_free(priv);
priv = NULL;
return NULL;
}
}

View File

@ -826,7 +826,7 @@ FAR struct mtd_dev_s *ramtron_initialize(FAR struct spi_dev_s *dev)
/* Unrecognized! Discard all of that work we just did and return NULL */
kmm_free(priv);
priv = NULL;
return NULL;
}
}

View File

@ -1208,7 +1208,7 @@ FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev)
ferr("ERROR: Unrecognized\n");
kmm_free(priv);
priv = NULL;
return NULL;
}
else
{

View File

@ -956,7 +956,7 @@ FAR struct mtd_dev_s *sst25xx_initialize(FAR struct spi_dev_s *dev)
ferr("ERROR: Unrecognized\n");
kmm_free(priv);
priv = NULL;
return NULL;
}
else
{

View File

@ -934,7 +934,7 @@ FAR struct mtd_dev_s *sst26_initialize_spi(FAR struct spi_dev_s *dev)
ssterr("ERROR: Unrecognized\n");
kmm_free(priv);
priv = NULL;
return NULL;
}
else
{

View File

@ -1258,7 +1258,7 @@ FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *spi)
ferr("ERROR: Unrecognized\n");
kmm_free(priv);
priv = NULL;
return NULL;
}
else
{