Skip to content

Commit 407c450

Browse files
AI review fixes
1 parent a36bca5 commit 407c450

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

examples/shell/shell_common/cmd_otcli.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ CHIP_ERROR cmd_otcli_dispatch(int argc, char ** argv)
108108
return CHIP_NO_ERROR;
109109
}
110110

111-
static const shell_command_t cmds_otcli_root = { &cmd_otcli_dispatch, "otcli", "Dispatch OpenThread CLI command" };
112-
113111
#if OPENTHREAD_API_VERSION >= 85
114112
#if !CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI
115113
static int OnOtCliOutput(void * aContext, const char * aFormat, va_list aArguments)
@@ -170,10 +168,14 @@ CHIP_ERROR cmd_otcli_dispatch(int argc, char ** argv)
170168
}
171169
}
172170

173-
static const shell_command_t cmds_otcli_root = { &cmd_otcli_dispatch, "otcli", "Dispatch OpenThread CLI command" };
174-
175171
#endif // CHIP_TARGET_STYLE_EMBEDDED/UNIX
176172

173+
#if (CHIP_TARGET_STYLE_EMBEDDED && \
174+
(CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI || (defined(CONFIG_OPENTHREAD_SHELL) && CONFIG_OPENTHREAD_SHELL))) || \
175+
CHIP_TARGET_STYLE_UNIX
176+
static const shell_command_t cmds_otcli_root = { &cmd_otcli_dispatch, "otcli", "Dispatch OpenThread CLI command" };
177+
#endif
178+
177179
#endif // CHIP_ENABLE_OPENTHREAD
178180

179181
void cmd_otcli_init()

src/crypto/CHIPCryptoPALmbedTLSCert.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
#include <lib/support/CodeUtils.h>
2929
#include <lib/support/SafeInt.h>
3030

31-
#include <mbedtls/version.h>
32-
3331
// mbedTLS X.509 headers and symbols are only needed when the active mbedtls
3432
// config (MBEDTLS_CONFIG_FILE) enables the corresponding features.
3533
#if defined(MBEDTLS_X509_CRT_PARSE_C) || defined(MBEDTLS_X509_CSR_PARSE_C) || defined(MBEDTLS_X509_CSR_WRITE_C)
34+
35+
#include <mbedtls/version.h>
36+
3637
// mbedtls/ecp.h (mbedtls_ecp_* symbols) is only used by the legacy non-PSA path
3738
// and became private in mbedTLS 4.1.0, so include it only before 4.1.0.
3839
#if (MBEDTLS_VERSION_NUMBER < 0x04010000)

src/platform/nrfconnect/ConfigurationManagerImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <lib/support/CodeUtils.h>
3030
#include <lib/support/logging/CHIPLogging.h>
3131
#include <platform/Zephyr/ZephyrConfig.h>
32-
#include <platform/internal/GenericConfigurationManagerImpl.h>
32+
#include <platform/internal/GenericConfigurationManagerImpl.ipp>
3333

3434
#ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_SETTINGS
3535
#include <zephyr/settings/settings.h>

src/platform/nrfconnect/FactoryDataProvider.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ CHIP_ERROR FactoryDataProvider<FlashFactoryData>::MoveDACPrivateKeyToSecureStora
200200
size_t requiredFlashSpaceSize = ROUND_UP(kDACPrivateKeyLength + bytesToLeftBefore, flashParameters->write_block_size);
201201
size_t bytesToLeftAfter = requiredFlashSpaceSize - bytesToLeftBefore - kDACPrivateKeyLength;
202202

203+
VerifyOrReturnError(mFactoryData.dacPrivateKeyOffset + kDACPrivateKeyLength <= factoryDataSize, CHIP_ERROR_INVALID_ARGUMENT);
204+
VerifyOrReturnError(alignedDacPrivKeyOffset + requiredFlashSpaceSize <= factoryDataSize, CHIP_ERROR_INVALID_ARGUMENT);
205+
203206
// Allocate the memory buffer for removing DAC private key.
204207
chip::Platform::ScopedMemoryBuffer<uint8_t> removedPrivKeyBuffer;
205208
VerifyOrReturnError(removedPrivKeyBuffer.Calloc(requiredFlashSpaceSize), CHIP_ERROR_NO_MEMORY);

0 commit comments

Comments
 (0)