bugfix: fix power_of_2 bug

backport a patch to fix power_of_2 bug

Signed-off-by: chenjingwen <lhchenjw@gmail.com>
This commit is contained in:
chenjingwen 2023-11-21 10:01:05 +08:00
parent 78c55982ee
commit aeb1902228
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 2ddd09ee581829e482d55db70b0cc92724b23c8d Mon Sep 17 00:00:00 2001
From: chenjingwen <lhchenjw@gmail.com>
Date: Mon, 20 Nov 2023 10:48:18 +0800
Subject: [PATCH 2/2] service: fix power_of_2 bug
fix a bug
Signed-off-by: chenjingwen <lhchenjw@gmail.com>
---
observer_agent/service/main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/observer_agent/service/main.cpp b/observer_agent/service/main.cpp
index 940cf83..f177645 100644
--- a/observer_agent/service/main.cpp
+++ b/observer_agent/service/main.cpp
@@ -51,7 +51,7 @@ static bool power_of_2(unsigned int num)
{
if (num == 0)
return false;
- if (num & (num - 1) != 0)
+ if ((num & (num - 1)) != 0)
return false;
return true;
}
--
2.33.0

View File

@ -5,7 +5,7 @@
Name : secDetector
Summary : OS Security Intrusion Detection System
Version : 1.0
Release : 2
Release : 3
License : GPL-2.0
Source0 : %{name}-v%{version}.tar.gz
BuildRequires: kernel-devel kernel-headers
@ -16,6 +16,7 @@ Requires : kernel
Requires : protobuf grpc libuuid libbpf
Patch0001: 0001-fix-report-api-function.patch
Patch0002: Backport-service-fix-power_of_2-bug.patch
%description
OS Security Intrusion Detection System
@ -89,6 +90,9 @@ rm -rf %{buildroot}
%attr(0644,root,root) /usr/include/secDetector/secDetector_topic.h
%changelog
* Tue Nov 21 2023 chenjingwen6 <lhchenjw@gmail.com> 1.0-3
- add patch to fix power_of_2 bug
* Sun Nov 19 2023 hurricane618 <hurricane618@hotmail.com> 1.0-2
- add fix patch