Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion fs/shm/shmfs_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ FAR struct shmfs_object_s *shmfs_alloc_object(size_t length)
* chunk in kernel heap
*/

object = kmm_zalloc(sizeof(struct shmfs_object_s) + length);
size_t alloc_size = sizeof(struct shmfs_object_s) + length;
if (alloc_size < length)
{
/* There must have been an integer overflow */

return NULL;
}

object = kmm_zalloc(alloc_size);
if (object)
{
object->paddr = (FAR char *)(object + 1);
Expand Down