essl: fix logical bug in argument check

https://pvs-studio.com/en/blog/posts/cpp/0790/#IDBDD4F1FD2D
Reported in https://github.com/espressif/esp-idf/issues/6440
This commit is contained in:
Ivan Grokhotkov 2022-03-14 18:44:07 +01:00
parent 0fe3281713
commit 6a4a6d584b
No known key found for this signature in database
GPG Key ID: 1E050E141B280628
2 changed files with 6 additions and 15 deletions

View File

@ -1,16 +1,8 @@
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "essl_sdio.h"
#include "esp_log.h"
@ -206,7 +198,7 @@ esp_err_t essl_sdio_init(void *arg, uint32_t wait_ms)
ESP_LOGD(TAG, "Function 0 BS: %04x", (int) bs_read);
// Set block sizes for functions 1 to given value (default value = 512).
if (ctx->block_size > 0 || ctx->block_size <= 2048) {
if (ctx->block_size > 0 && ctx->block_size <= 2048) {
bs = ctx->block_size;
} else {
bs = 512;

View File

@ -672,7 +672,6 @@ components/esp_rom/test/test_miniz.c
components/esp_rom/test/test_tjpgd.c
components/esp_serial_slave_link/essl.c
components/esp_serial_slave_link/essl_internal.h
components/esp_serial_slave_link/essl_sdio.c
components/esp_serial_slave_link/include/esp_serial_slave_link/essl.h
components/esp_serial_slave_link/include/esp_serial_slave_link/essl_sdio.h
components/esp_serial_slave_link/include/esp_serial_slave_link/essl_spi.h