From 88102c102a9142fc02e1e467bcf686db32eee964 Mon Sep 17 00:00:00 2001 From: guruhegde Date: Fri, 25 Oct 2019 16:22:32 +0200 Subject: [PATCH] Update fast_flows.c * Add check for flow state NULL --- src/BatchMaker.cpp | 2 +- test/unittests/inputs/fast_flows.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/BatchMaker.cpp b/src/BatchMaker.cpp index 30c4b2d..f31ce0f 100644 --- a/src/BatchMaker.cpp +++ b/src/BatchMaker.cpp @@ -79,7 +79,6 @@ void BatchMaker::createBatchedFormFnPrototype(vector & BatchFuncArgL void BatchMaker::replaceOldArgUsesWithBatchArgs(vector & BatchFuncArgList, AllocaInst * IdxPtr) { auto EntryBB = &BatchFunc->front(); - Builder.SetInsertPoint(&EntryBB->front()); SmallVector BatchArgs; for_each(BatchFuncArgList.begin(), BatchFuncArgList.end(), @@ -87,6 +86,7 @@ void BatchMaker::replaceOldArgUsesWithBatchArgs(vector & BatchFuncAr if (Attr.IsBatch) BatchArgs.push_back(Attr.Val); }); for (auto & BatchArg : BatchArgs) { + Builder.SetInsertPoint(&EntryBB->front()); auto BatchArgAlloca = Builder.CreateAlloca(BatchArg->getType()); auto StoreI = findFirstUseInStoreInst(BatchArg); diff --git a/test/unittests/inputs/fast_flows.c b/test/unittests/inputs/fast_flows.c index 8d65af2..6bee9e9 100644 --- a/test/unittests/inputs/fast_flows.c +++ b/test/unittests/inputs/fast_flows.c @@ -303,6 +303,9 @@ int fast_flows_packet(struct dataplane_context *ctx, flow_id = fs - fp_state->flowst; trigger_ack = 0, fin_bump = 0; + if (fs == NULL) + return -1; + tcp_extra_hlen = (TCPH_HDRLEN(&p->tcp) - 5) * 4; payload_off = sizeof(*p) + tcp_extra_hlen; payload_bytes = -- GitLab