diff --git a/.clang-tidy b/.clang-tidy
index 61f2c68..eae3c72 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -202,6 +202,7 @@
 clang-analyzer-webkit.NoUncountedMemberChecker,
 clang-analyzer-webkit.RefCntblBaseVirtualDtor,
 cppcoreguidelines-init-variables,
+cppcoreguidelines-pro-bounds-pointer-arithmetic,
 cppcoreguidelines-pro-type-reinterpret-cast,
 cppcoreguidelines-special-member-functions,
 misc-misplaced-const,
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 840f2b6..ad6855f 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -182,11 +182,13 @@
 
             for (int i = 0; i < usage->length; i++)
             {
-                if (KU_DIGITAL_SIGNATURE & usage->data[i])
+                // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+                unsigned char usageChar = usage->data[i];
+                if (KU_DIGITAL_SIGNATURE & usageChar)
                 {
                     isKeyUsageDigitalSignature = true;
                 }
-                if (KU_KEY_AGREEMENT & usage->data[i])
+                if (KU_KEY_AGREEMENT & usageChar)
                 {
                     isKeyUsageKeyAgreement = true;
                 }
diff --git a/include/async_resolve.hpp b/include/async_resolve.hpp
index c69fd87..0945001 100644
--- a/include/async_resolve.hpp
+++ b/include/async_resolve.hpp
@@ -80,6 +80,7 @@
                     }
                     uint16_t portNum = 0;
                     auto it = std::from_chars(
+                        // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
                         port.data(), port.data() + port.size(), portNum);
                     if (it.ec != std::errc())
                     {
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 4fbb503..5a86d09 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -535,9 +535,14 @@
     // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
     uint8_t* q = reinterpret_cast<uint8_t*>(&resourceId2);
 
-    BMCWEB_LOG_DEBUG << "Comparing bytes " << std::to_string(p[position]) << ","
-                     << std::to_string(q[position]);
-    if (p[position] != q[position])
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+    uint8_t pPosition = p[position];
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+    uint8_t qPosition = q[position];
+
+    BMCWEB_LOG_DEBUG << "Comparing bytes " << std::to_string(pPosition) << ","
+                     << std::to_string(qPosition);
+    if (pPosition != qPosition)
     {
         return false;
     }
diff --git a/include/json_html_serializer.hpp b/include/json_html_serializer.hpp
index 3efc224..4969d27 100644
--- a/include/json_html_serializer.hpp
+++ b/include/json_html_serializer.hpp
@@ -353,6 +353,7 @@
 
     // jump to the end to generate the string from backward
     // so we later avoid reversing the result
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
     bufferPtr += nChars;
 
     // Fast int2ascii implementation inspired by "Fastware" talk by Andrei
@@ -384,6 +385,8 @@
 {
     std::array<char, 64> numberbuffer{{}};
     char* begin = numberbuffer.data();
+
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
     ::nlohmann::detail::to_chars(begin, begin + numberbuffer.size(), number);
 
     out += begin;
diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp
index 3728311..e385558 100644
--- a/include/multipart_parser.hpp
+++ b/include/multipart_parser.hpp
@@ -79,6 +79,7 @@
 
         for (size_t i = 0; i < len; i++)
         {
+            // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
             char c = buffer[i];
             switch (state)
             {
@@ -139,6 +140,8 @@
                         {
                             return ParserError::ERROR_EMPTY_HEADER;
                         }
+
+                        // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
                         currentHeaderName.append(buffer + headerFieldMark,
                                                  i - headerFieldMark);
                         state = State::HEADER_VALUE_START;
@@ -161,6 +164,7 @@
                 case State::HEADER_VALUE:
                     if (c == cr)
                     {
+                        // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
                         std::string_view value(buffer + headerValueMark,
                                                i - headerValueMark);
                         mime_fields.rbegin()->fields.set(currentHeaderName,
@@ -190,6 +194,8 @@
                     if (index == 0)
                     {
                         skipNonBoundary(buffer, len, boundary.size() - 1, i);
+
+                        // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
                         c = buffer[i];
                     }
                     processPartData(prevIndex, index, buffer, i, c, state);
@@ -229,6 +235,7 @@
         // boyer-moore derived algorithm to safely skip non-boundary data
         while (i + boundary.size() <= len)
         {
+            // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
             if (isBoundaryChar(buffer[i + boundaryEnd]))
             {
                 break;
@@ -248,8 +255,11 @@
             {
                 if (index == 0)
                 {
-                    mime_fields.rbegin()->content += std::string_view(
-                        buffer + partDataMark, i - partDataMark);
+                    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+                    const char* start = buffer + partDataMark;
+                    size_t size = i - partDataMark;
+                    mime_fields.rbegin()->content +=
+                        std::string_view(start, size);
                 }
                 index++;
             }
diff --git a/include/pam_authenticate.hpp b/include/pam_authenticate.hpp
index 0ce0bb4..1459ea6 100644
--- a/include/pam_authenticate.hpp
+++ b/include/pam_authenticate.hpp
@@ -24,6 +24,7 @@
     for (int i = 0; i < numMsg; ++i)
     {
         /* Ignore all PAM messages except prompting for hidden input */
+        // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
         if (msg[i]->msg_style != PAM_PROMPT_ECHO_OFF)
         {
             continue;
@@ -66,6 +67,7 @@
         // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
         *resp = reinterpret_cast<pam_response*>(ptr);
 
+        // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
         resp[i]->resp = pass;
 
         return PAM_SUCCESS;
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 2cd35df..a33e061 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -2009,8 +2009,11 @@
                 const std::string& targetID = param;
 
                 uint64_t idInt = 0;
-                auto [ptr, ec] = std::from_chars(
-                    targetID.data(), targetID.data() + targetID.size(), idInt);
+
+                // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+                const char* end = targetID.data() + targetID.size();
+
+                auto [ptr, ec] = std::from_chars(targetID.data(), end, idInt);
                 if (ec == std::errc::invalid_argument)
                 {
                     messages::resourceMissingAtURI(asyncResp->res, targetID);
@@ -3389,7 +3392,9 @@
         return false;
     }
 
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
     const char* start = split[0].data() + 1;
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
     const char* end = split[0].data() + split[0].size();
     auto [ptrIndex, ecIndex] = std::from_chars(start, end, index);
 
@@ -3399,6 +3404,8 @@
     }
 
     start = split[1].data();
+
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
     end = split[1].data() + split[1].size();
     auto [ptrValue, ecValue] = std::from_chars(start, end, currentValue);
     if (ptrValue != end || ecValue != std::errc())
