* [PATCH] tools/firewire: nosy-dump: check for allocation failure
[not found] <BAY167-W2929963ACD86D27998ACE8BB7A0@phx.gbl>
@ 2012-10-22 13:17 ` Stefan Richter
0 siblings, 0 replies; only message in thread
From: Stefan Richter @ 2012-10-22 13:17 UTC (permalink / raw)
To: linux1394-devel; +Cc: yang yeping, linux-kernel
Behavior of null pointer dereference is undefined in the C language.
Portably implement the desired behavior.
Reported-by: Yang Yeping <yangyeping_666@hotmail.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
tools/firewire/nosy-dump.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/tools/firewire/nosy-dump.c
+++ b/tools/firewire/nosy-dump.c
@@ -150,6 +150,8 @@ subaction_create(uint32_t *data, size_t
/* we put the ack in the subaction struct for easy access. */
sa = malloc(sizeof *sa - sizeof sa->packet + length);
+ if (!sa)
+ exit(EXIT_FAILURE);
sa->ack = data[length / 4 - 1];
sa->length = length;
memcpy(&sa->packet, data, length);
@@ -180,6 +182,8 @@ link_transaction_lookup(int request_node
}
t = malloc(sizeof *t);
+ if (!t)
+ exit(EXIT_FAILURE);
t->request_node = request_node;
t->response_node = response_node;
t->tlabel = tlabel;
--
Stefan Richter
-=====-===-- =-=- =-==-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-10-22 13:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <BAY167-W2929963ACD86D27998ACE8BB7A0@phx.gbl>
2012-10-22 13:17 ` [PATCH] tools/firewire: nosy-dump: check for allocation failure Stefan Richter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.