Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi-tenant: fix coverity warning #10395

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/detect-engine-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ static TmEcode DetectLoaderThreadInit(ThreadVars *t, const void *initdata, void

DetectLoaderControl *loader = &loaders[ftd->instance];
SCMutexLock(&loader->m);
loader->tv = t;
SCMutexUnlock(&loader->m);
loader->tv = t;

return TM_ECODE_OK;
}
Expand Down
4 changes: 2 additions & 2 deletions src/detect-engine-loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ typedef struct DetectLoaderTask_ {
typedef struct DetectLoaderControl_ {
int id;
int result; /* 0 for ok, error otherwise */
ThreadVars *tv; /* loader threads threadvars - for waking them up */
SCMutex m;
SCMutex m; /**< mutex protectx result and task_list */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor typo: protectx
Q: Why did you do this reordering of struct items? To have the cacheline boundary fall outside of task_list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a perf critical struct, so I reordered things to have the mutex and the members it protects grouped together

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. Thank you. This PR looks good to me. If you're fixing the typo in comment, I'll wait for the next PR to approve.

TAILQ_HEAD(, DetectLoaderTask_) task_list;
ThreadVars *tv; /* loader threads threadvars - for waking them up */
} DetectLoaderControl;

int DetectLoaderQueueTask(int loader_id, LoaderFunc Func, void *func_ctx, LoaderFreeFunc FreeFunc);
Expand Down
Loading