From 1f0cf8b2b4bb6e36d8d82323a15ced72d91db0ec Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 22 Jul 2012 20:40:41 -0400 Subject: [PATCH] rx: rxi_FindRpcStat must test for empty queue When queue_Scan is executed on an empty queue the queue element variable, in this case 'rpc_stat' is the queue head, _RXQ(q), and not NULL. Callers of rxi_FindRpcStat() expect NULL on failure to find or create an rx_interface_stat object. Correct the behavior by testing for an empty queue and return NULL immediately if the queue is empty and the caller is not requesting creation. Change-Id: I9952d7aaf357e039e87f6b8b17cb1a00208d6465 Reviewed-on: http://gerrit.openafs.org/7835 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- src/rx/rx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rx/rx.c b/src/rx/rx.c index 81dff70..0f30eb6 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -8110,6 +8110,10 @@ rxi_FindRpcStat(struct rx_queue *stats, afs_uint32 rxInterface, unsigned int *counter, int create) { rx_interface_stat_p rpc_stat, nrpc_stat; + + if (queue_IsEmpty(stats) && !create) + return NULL; + /* * See if there's already a structure for this interface */ -- 1.9.4