diff --git a/apphandler.cpp b/apphandler.cpp
index 62b17a0..fd735bb 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -71,25 +71,25 @@
 typedef struct
 {
     uint8_t busId;
-    uint8_t slaveAddr;
-    uint8_t slaveAddrMask;
+    uint8_t targetAddr;
+    uint8_t targetAddrMask;
     std::vector<uint8_t> data;
     std::vector<uint8_t> dataMask;
-} i2cMasterWRWhitelist;
+} i2cControllerWRAllowlist;
 
-static std::vector<i2cMasterWRWhitelist>& getWRWhitelist()
+static std::vector<i2cControllerWRAllowlist>& getWRAllowlist()
 {
-    static std::vector<i2cMasterWRWhitelist> wrWhitelist;
-    return wrWhitelist;
+    static std::vector<i2cControllerWRAllowlist> wrAllowlist;
+    return wrAllowlist;
 }
 
-static constexpr const char* i2cMasterWRWhitelistFile =
+static constexpr const char* i2cControllerWRAllowlistFile =
     "/usr/share/ipmi-providers/master_write_read_white_list.json";
 
 static constexpr const char* filtersStr = "filters";
 static constexpr const char* busIdStr = "busId";
-static constexpr const char* slaveAddrStr = "slaveAddr";
-static constexpr const char* slaveAddrMaskStr = "slaveAddrMask";
+static constexpr const char* targetAddrStr = "slaveAddr";
+static constexpr const char* targetAddrMaskStr = "slaveAddrMask";
 static constexpr const char* cmdStr = "command";
 static constexpr const char* cmdMaskStr = "commandMask";
 static constexpr int base_16 = 16;
@@ -1533,15 +1533,16 @@
     return dataValue;
 }
 
-static bool populateI2CMasterWRWhitelist()
+static bool populateI2CControllerWRAllowlist()
 {
     nlohmann::json data = nullptr;
-    std::ifstream jsonFile(i2cMasterWRWhitelistFile);
+    std::ifstream jsonFile(i2cControllerWRAllowlistFile);
 
     if (!jsonFile.good())
     {
-        log<level::WARNING>("i2c white list file not found!",
-                            entry("FILE_NAME: %s", i2cMasterWRWhitelistFile));
+        log<level::WARNING>(
+            "i2c allow list file not found!",
+            entry("FILE_NAME: %s", i2cControllerWRAllowlistFile));
         return false;
     }
 
@@ -1551,8 +1552,8 @@
     }
     catch (const nlohmann::json::parse_error& e)
     {
-        log<level::ERR>("Corrupted i2c white list config file",
-                        entry("FILE_NAME: %s", i2cMasterWRWhitelistFile),
+        log<level::ERR>("Corrupted i2c allow list config file",
+                        entry("FILE_NAME: %s", i2cControllerWRAllowlistFile),
                         entry("MSG: %s", e.what()));
         return false;
     }
@@ -1581,15 +1582,15 @@
         //    },]
 
         nlohmann::json filters = data[filtersStr].get<nlohmann::json>();
-        std::vector<i2cMasterWRWhitelist>& whitelist = getWRWhitelist();
+        std::vector<i2cControllerWRAllowlist>& allowlist = getWRAllowlist();
         for (const auto& it : filters.items())
         {
             nlohmann::json filter = it.value();
             if (filter.is_null())
             {
                 log<level::ERR>(
-                    "Corrupted I2C master write read whitelist config file",
-                    entry("FILE_NAME: %s", i2cMasterWRWhitelistFile));
+                    "Corrupted I2C controller write read allowlist config file",
+                    entry("FILE_NAME: %s", i2cControllerWRAllowlistFile));
                 return false;
             }
             const std::vector<uint8_t>& writeData =
@@ -1598,38 +1599,39 @@
                 convertStringToData(filter[cmdMaskStr].get<std::string>());
             if (writeDataMask.size() != writeData.size())
             {
-                log<level::ERR>("I2C master write read whitelist filter "
+                log<level::ERR>("I2C controller write read allowlist filter "
                                 "mismatch for command & mask size");
                 return false;
             }
-            whitelist.push_back(
+            allowlist.push_back(
                 {static_cast<uint8_t>(std::stoul(
                      filter[busIdStr].get<std::string>(), nullptr, base_16)),
                  static_cast<uint8_t>(
-                     std::stoul(filter[slaveAddrStr].get<std::string>(),
+                     std::stoul(filter[targetAddrStr].get<std::string>(),
                                 nullptr, base_16)),
                  static_cast<uint8_t>(
-                     std::stoul(filter[slaveAddrMaskStr].get<std::string>(),
+                     std::stoul(filter[targetAddrMaskStr].get<std::string>(),
                                 nullptr, base_16)),
                  writeData, writeDataMask});
         }
-        if (whitelist.size() != filters.size())
+        if (allowlist.size() != filters.size())
         {
             log<level::ERR>(
-                "I2C master write read whitelist filter size mismatch");
+                "I2C controller write read allowlist filter size mismatch");
             return false;
         }
     }
     catch (const std::exception& e)
     {
-        log<level::ERR>("I2C master write read whitelist unexpected exception",
-                        entry("ERROR=%s", e.what()));
+        log<level::ERR>(
+            "I2C controller write read allowlist unexpected exception",
+            entry("ERROR=%s", e.what()));
         return false;
     }
     return true;
 }
 
-static inline bool isWriteDataWhitelisted(const std::vector<uint8_t>& data,
+static inline bool isWriteDataAllowlisted(const std::vector<uint8_t>& data,
                                           const std::vector<uint8_t>& dataMask,
                                           const std::vector<uint8_t>& writeData)
 {
@@ -1643,15 +1645,15 @@
     return (processedDataBuf == processedReqBuf);
 }
 
-static bool isCmdWhitelisted(uint8_t busId, uint8_t slaveAddr,
+static bool isCmdAllowlisted(uint8_t busId, uint8_t targetAddr,
                              std::vector<uint8_t>& writeData)
 {
-    std::vector<i2cMasterWRWhitelist>& whiteList = getWRWhitelist();
-    for (const auto& wlEntry : whiteList)
+    std::vector<i2cControllerWRAllowlist>& allowList = getWRAllowlist();
+    for (const auto& wlEntry : allowList)
     {
         if ((busId == wlEntry.busId) &&
-            ((slaveAddr | wlEntry.slaveAddrMask) ==
-             (wlEntry.slaveAddr | wlEntry.slaveAddrMask)))
+            ((targetAddr | wlEntry.targetAddrMask) ==
+             (wlEntry.targetAddr | wlEntry.targetAddrMask)))
         {
             const std::vector<uint8_t>& dataMask = wlEntry.dataMask;
             // Skip as no-match, if requested write data is more than the
@@ -1660,7 +1662,7 @@
             {
                 continue;
             }
-            if (isWriteDataWhitelisted(wlEntry.data, dataMask, writeData))
+            if (isWriteDataAllowlisted(wlEntry.data, dataMask, writeData))
             {
                 return true;
             }
@@ -1669,21 +1671,21 @@
     return false;
 }
 #else
-static bool populateI2CMasterWRWhitelist()
+static bool populateI2CControllerWRAllowlist()
 {
     log<level::INFO>(
-        "I2C_WHITELIST_CHECK is disabled, do not populate whitelist");
+        "I2C_WHITELIST_CHECK is disabled, do not populate allowlist");
     return true;
 }
 #endif // ENABLE_I2C_WHITELIST_CHECK
 
-/** @brief implements master write read IPMI command which can be used for
+/** @brief implements controller write read IPMI command which can be used for
  * low-level I2C/SMBus write, read or write-read access
  *  @param isPrivateBus -to indicate private bus usage
  *  @param busId - bus id
  *  @param channelNum - channel number
  *  @param reserved - skip 1 bit
- *  @param slaveAddr - slave address
+ *  @param targetAddr - target address
  *  @param read count - number of bytes to be read
  *  @param writeData - data to be written
  *
@@ -1691,10 +1693,10 @@
  *   - readData - i2c response data
  */
 ipmi::RspType<std::vector<uint8_t>>
-    ipmiMasterWriteRead([[maybe_unused]] bool isPrivateBus, uint3_t busId,
-                        [[maybe_unused]] uint4_t channelNum, bool reserved,
-                        uint7_t slaveAddr, uint8_t readCount,
-                        std::vector<uint8_t> writeData)
+    ipmiControllerWriteRead([[maybe_unused]] bool isPrivateBus, uint3_t busId,
+                            [[maybe_unused]] uint4_t channelNum, bool reserved,
+                            uint7_t targetAddr, uint8_t readCount,
+                            std::vector<uint8_t> writeData)
 {
     if (reserved)
     {
@@ -1703,16 +1705,17 @@
     const size_t writeCount = writeData.size();
     if (!readCount && !writeCount)
     {
-        log<level::ERR>("Master write read command: Read & write count are 0");
+        log<level::ERR>(
+            "Controller write read command: Read & write count are 0");
         return ipmi::responseInvalidFieldRequest();
     }
 #ifdef ENABLE_I2C_WHITELIST_CHECK
-    if (!isCmdWhitelisted(static_cast<uint8_t>(busId),
-                          static_cast<uint8_t>(slaveAddr), writeData))
+    if (!isCmdAllowlisted(static_cast<uint8_t>(busId),
+                          static_cast<uint8_t>(targetAddr), writeData))
     {
-        log<level::ERR>("Master write read request blocked!",
+        log<level::ERR>("Controller write read request blocked!",
                         entry("BUS=%d", static_cast<uint8_t>(busId)),
-                        entry("ADDR=0x%x", static_cast<uint8_t>(slaveAddr)));
+                        entry("ADDR=0x%x", static_cast<uint8_t>(targetAddr)));
         return ipmi::responseInvalidFieldRequest();
     }
 #endif // ENABLE_I2C_WHITELIST_CHECK
@@ -1720,7 +1723,7 @@
     std::string i2cBus = "/dev/i2c-" +
                          std::to_string(static_cast<uint8_t>(busId));
 
-    ipmi::Cc ret = ipmi::i2cWriteRead(i2cBus, static_cast<uint8_t>(slaveAddr),
+    ipmi::Cc ret = ipmi::i2cWriteRead(i2cBus, static_cast<uint8_t>(targetAddr),
                                       writeData, readBuf);
     if (ret != ipmi::ccSuccess)
     {
@@ -1784,15 +1787,15 @@
                           ipmi::Privilege::User, ipmiGetAcpiPowerState);
 
     // Note: For security reason, this command will be registered only when
-    // there are proper I2C Master write read whitelist
-    if (populateI2CMasterWRWhitelist())
+    // there are proper I2C Controller write read allowlist
+    if (populateI2CControllerWRAllowlist())
     {
-        // Note: For security reasons, registering master write read as admin
-        // privilege command, even though IPMI 2.0 specification allows it as
-        // operator privilege.
+        // Note: For security reasons, registering controller write read as
+        // admin privilege command, even though IPMI 2.0 specification allows it
+        // as operator privilege.
         ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnApp,
                               ipmi::app::cmdMasterWriteRead,
-                              ipmi::Privilege::Admin, ipmiMasterWriteRead);
+                              ipmi::Privilege::Admin, ipmiControllerWriteRead);
     }
 
     // <Get System GUID Command>
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 31bca0c..07f1b63 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -684,12 +684,12 @@
         // Optional Platform Attributes
         case DCMICapParameters::OptionalPlatAttributes:
         {
-            uint7_t powerMgmtDeviceSlaveAddress =
+            uint7_t powerMgmtDeviceTargetAddress =
                 data.value("PowerMgmtDeviceSlaveAddress", 0);
             uint4_t bmcChannelNumber = data.value("BMCChannelNumber", 0);
             uint4_t deviceRivision = data.value("DeviceRivision", 0);
-            payload.pack(powerMgmtDeviceSlaveAddress, reserved1, deviceRivision,
-                         bmcChannelNumber);
+            payload.pack(powerMgmtDeviceTargetAddress, reserved1,
+                         deviceRivision, bmcChannelNumber);
             break;
         }
         // Manageability Access Attributes
diff --git a/generate_whitelist.sh b/generate_whitelist.sh
index d7d2a71..223ef75 100755
--- a/generate_whitelist.sh
+++ b/generate_whitelist.sh
@@ -7,7 +7,7 @@
 fi
 
 cat << EOF
-#include <ipmiwhitelist.hpp>
+#include <ipmiallowlist.hpp>
 
 const std::vector<netfncmd_pair> whitelist = {
 
diff --git a/include/dbus-sdr/storagecommands.hpp b/include/dbus-sdr/storagecommands.hpp
index c8baaf1..7b3046c 100644
--- a/include/dbus-sdr/storagecommands.hpp
+++ b/include/dbus-sdr/storagecommands.hpp
@@ -81,7 +81,7 @@
 struct Type12Record
 {
     get_sdr::SensorDataRecordHeader header;
-    uint8_t slaveAddress;
+    uint8_t targetAddress;
     uint8_t channelNumber;
     uint8_t powerStateNotification;
     uint8_t deviceCapabilities;
@@ -98,7 +98,7 @@
                  uint8_t pwrStateNotification, uint8_t capabilities,
                  uint8_t eid, uint8_t entityInst, uint8_t mfrDefined,
                  const std::string& sensorname) :
-        slaveAddress(address),
+        targetAddress(address),
         channelNumber(chNumber), powerStateNotification(pwrStateNotification),
         deviceCapabilities(capabilities), reserved{}, entityID(eid),
         entityInstance(entityInst), oem(mfrDefined)
diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp
index 20f9847..1e2005f 100644
--- a/include/ipmid/utils.hpp
+++ b/include/ipmid/utils.hpp
@@ -457,11 +457,11 @@
 
 /** @brief Perform the low-level i2c bus write-read.
  *  @param[in] i2cBus - i2c bus device node name, such as /dev/i2c-2.
- *  @param[in] slaveAddr - i2c device slave address.
+ *  @param[in] targetAddr - i2c device target address.
  *  @param[in] writeData - The data written to i2c device.
  *  @param[out] readBuf - Data read from the i2c device.
  */
-ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t slaveAddr,
+ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t targetAddr,
                       std::vector<uint8_t> writeData,
                       std::vector<uint8_t>& readBuf);
 } // namespace ipmi
diff --git a/ipmiwhitelist.hpp b/ipmiallowlist.hpp
similarity index 69%
rename from ipmiwhitelist.hpp
rename to ipmiallowlist.hpp
index fd45a3d..7519de8 100644
--- a/ipmiwhitelist.hpp
+++ b/ipmiallowlist.hpp
@@ -5,4 +5,4 @@
 
 using netfncmd_pair = std::pair<unsigned char, unsigned char>;
 
-extern const std::vector<netfncmd_pair> whitelist;
+extern const std::vector<netfncmd_pair> allowlist;
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index 1c94aad..f7e9802 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -564,7 +564,7 @@
 
 /********* End co-routine yielding alternatives ***************/
 
-ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t slaveAddr,
+ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t targetAddr,
                       std::vector<uint8_t> writeData,
                       std::vector<uint8_t>& readBuf)
 {
@@ -583,8 +583,8 @@
     i2c_msg i2cmsg[2] = {};
     if (writeCount)
     {
-        // Data will be writtern to the slave address
-        i2cmsg[msgCount].addr = slaveAddr;
+        // Data will be writtern to the target address
+        i2cmsg[msgCount].addr = targetAddr;
         i2cmsg[msgCount].flags = 0x00;
         i2cmsg[msgCount].len = writeCount;
         i2cmsg[msgCount].buf = writeData.data();
@@ -592,8 +592,8 @@
     }
     if (readCount)
     {
-        // Data will be read into the buffer from the slave address
-        i2cmsg[msgCount].addr = slaveAddr;
+        // Data will be read into the buffer from the target address
+        i2cmsg[msgCount].addr = targetAddr;
         i2cmsg[msgCount].flags = I2C_M_RD;
         i2cmsg[msgCount].len = readCount;
         i2cmsg[msgCount].buf = readBuf.data();
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 1483456..ad7286b 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -24,7 +24,7 @@
 
 static constexpr uint8_t fruInventoryDevice = 0x10;
 static constexpr uint8_t IPMIFruInventory = 0x02;
-static constexpr uint8_t BMCSlaveAddress = 0x20;
+static constexpr uint8_t BMCTargetAddress = 0x20;
 
 extern int updateSensorRecordFromSSRAESC(const void*);
 extern sd_bus* bus;
@@ -1150,7 +1150,7 @@
     /* Key */
     record.key.fruID = fruID;
     record.key.accessLun |= IPMI_LOGICAL_FRU;
-    record.key.deviceAddress = BMCSlaveAddress;
+    record.key.deviceAddress = BMCTargetAddress;
 
     /* Body */
     record.body.entityID = fru->second[0].entityID;
diff --git a/whitelist-filter.cpp b/whitelist-filter.cpp
index cb0d4eb..be98e1c 100644
--- a/whitelist-filter.cpp
+++ b/whitelist-filter.cpp
@@ -1,6 +1,6 @@
+#include <ipmiallowlist.hpp>
 #include <ipmid/api.hpp>
 #include <ipmid/utils.hpp>
-#include <ipmiwhitelist.hpp>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/log.hpp>
 #include <settings.hpp>
@@ -20,20 +20,20 @@
 namespace
 {
 
-/** @class WhitelistFilter
+/** @class AllowlistFilter
  *
  * Class that implements an IPMI message filter based
  * on incoming interface and a restriction mode setting
  */
-class WhitelistFilter
+class AllowlistFilter
 {
   public:
-    WhitelistFilter();
-    ~WhitelistFilter() = default;
-    WhitelistFilter(const WhitelistFilter&) = delete;
-    WhitelistFilter(WhitelistFilter&&) = delete;
-    WhitelistFilter& operator=(const WhitelistFilter&) = delete;
-    WhitelistFilter& operator=(WhitelistFilter&&) = delete;
+    AllowlistFilter();
+    ~AllowlistFilter() = default;
+    AllowlistFilter(const AllowlistFilter&) = delete;
+    AllowlistFilter(AllowlistFilter&&) = delete;
+    AllowlistFilter& operator=(const AllowlistFilter&) = delete;
+    AllowlistFilter& operator=(AllowlistFilter&&) = delete;
 
   private:
     void postInit();
@@ -52,11 +52,11 @@
         "xyz.openbmc_project.Control.Security.RestrictionMode";
 };
 
-WhitelistFilter::WhitelistFilter()
+AllowlistFilter::AllowlistFilter()
 {
     bus = getSdBus();
 
-    log<level::INFO>("Loading whitelist filter");
+    log<level::INFO>("Loading allowlist filter");
     ipmi::registerFilter(ipmi::prioOpenBmcBase,
                          [this](ipmi::message::Request::ptr request) {
         return filterMessage(request);
@@ -72,7 +72,7 @@
  *  @returns void.
  */
 
-void WhitelistFilter::cacheRestrictedMode(
+void AllowlistFilter::cacheRestrictedMode(
     const std::vector<std::string>& devices)
 {
     using namespace sdbusplus::server::xyz::openbmc_project::control::security;
@@ -128,7 +128,7 @@
  *  @returns void.
  */
 
-void WhitelistFilter::handleRestrictedModeChange(
+void AllowlistFilter::handleRestrictedModeChange(
     sdbusplus::message_t& m, const std::map<std::string, size_t>& deviceList)
 {
     using namespace sdbusplus::server::xyz::openbmc_project::control::security;
@@ -170,7 +170,7 @@
  *  @returns void.
  */
 
-void WhitelistFilter::postInit()
+void AllowlistFilter::postInit()
 {
     objects = std::make_unique<settings::Objects>(
         *bus, std::vector<settings::Interface>({restrictionModeIntf}));
@@ -220,7 +220,7 @@
  *  @returns IPMI completion code success or error.
  */
 
-ipmi::Cc WhitelistFilter::filterMessage(ipmi::message::Request::ptr request)
+ipmi::Cc AllowlistFilter::filterMessage(ipmi::message::Request::ptr request)
 {
     /* Getting hostIdx for all IPMI devices like hosts, debugcard and other
    devices from ipmi::message::Request and call postInit() to get the
@@ -232,10 +232,10 @@
         restrictedMode[hostIdx])
     {
         if (!std::binary_search(
-                whitelist.cbegin(), whitelist.cend(),
+                allowlist.cbegin(), allowlist.cend(),
                 std::make_pair(request->ctx->netFn, request->ctx->cmd)))
         {
-            log<level::ERR>("Net function not whitelisted",
+            log<level::ERR>("Net function not allowlisted",
                             entry("NETFN=0x%X", int(request->ctx->netFn)),
                             entry("CMD=0x%X", int(request->ctx->cmd)));
 
@@ -245,8 +245,8 @@
     return ipmi::ccSuccess;
 }
 
-// instantiate the WhitelistFilter when this shared object is loaded
-WhitelistFilter whitelistFilter;
+// instantiate the AllowlistFilter when this shared object is loaded
+AllowlistFilter allowlistFilter;
 
 } // namespace
 
