aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2010-11-07 16:04:43 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-11-11 10:14:07 -0500
commit793b62337ecf1bf9a816fcb7105bb1ca424cf7d4 (patch)
tree218ea2beb29315ee118ef7b127a3120b5270f18f /drivers/uwb
parent886ccd4520064408ce5876cfe00554ce52ecf4a7 (diff)
UWB: Return UWB_RSV_ALLOC_NOT_FOUND rather than crashing on NULL dereference if kzalloc fails
Crashing on a null pointer deref is never a nice thing to do. It seems to me that it's better to simply return UWB_RSV_ALLOC_NOT_FOUND if kzalloc() fails in uwb_rsv_find_best_allocation(). Signed-off-by: Jesper Juhl <jj@chaosbits.net> Acked-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/uwb')
-rw-r--r--drivers/uwb/allocator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/uwb/allocator.c b/drivers/uwb/allocator.c
index 436e4f7110cb..e45e673b8770 100644
--- a/drivers/uwb/allocator.c
+++ b/drivers/uwb/allocator.c
@@ -326,7 +326,8 @@ int uwb_rsv_find_best_allocation(struct uwb_rsv *rsv, struct uwb_mas_bm *availab
326 int bit_index; 326 int bit_index;
327 327
328 ai = kzalloc(sizeof(struct uwb_rsv_alloc_info), GFP_KERNEL); 328 ai = kzalloc(sizeof(struct uwb_rsv_alloc_info), GFP_KERNEL);
329 329 if (!ai)
330 return UWB_RSV_ALLOC_NOT_FOUND;
330 ai->min_mas = rsv->min_mas; 331 ai->min_mas = rsv->min_mas;
331 ai->max_mas = rsv->max_mas; 332 ai->max_mas = rsv->max_mas;
332 ai->max_interval = rsv->max_interval; 333 ai->max_interval = rsv->max_interval;