1. 24 Feb, 2024 9 commits
    • Adam Guerin's avatar
      crypto: qat - remove double initialization of value · a66cf93a
      Adam Guerin authored
      Remove double initialization of the reg variable.
      
      This is to fix the following warning when compiling the QAT driver
      using clang scan-build:
          drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c:1010:6: warning: Value stored to 'reg' during its initialization is never read [deadcode.DeadStores]
           1010 |         u32 reg = ADF_CSR_RD(csr, ADF_GEN4_SSMCPPERR);
                |             ^~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c:1109:6: warning: Value stored to 'reg' during its initialization is never read [deadcode.DeadStores]
           1109 |         u32 reg = ADF_CSR_RD(csr, ADF_GEN4_SER_ERR_SSMSH);
                |             ^~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Fixes: 99b1c982 ("crypto: qat - count QAT GEN4 errors")
      Signed-off-by: default avatarAdam Guerin <adam.guerin@intel.com>
      Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a66cf93a
    • Adam Guerin's avatar
      crypto: qat - avoid division by zero · f99fb7d6
      Adam Guerin authored
      Check if delta_us is not zero and return -EINVAL if it is.
      delta_us is unlikely to be zero as there is a sleep between the reads of
      the two timestamps.
      
      This is to fix the following warning when compiling the QAT driver
      using clang scan-build:
          drivers/crypto/intel/qat/qat_common/adf_clock.c:87:9: warning: Division by zero [core.DivideZero]
             87 |         temp = DIV_ROUND_CLOSEST_ULL(temp, delta_us);
                |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Fixes: e2980ba5 ("crypto: qat - add measure clock frequency")
      Signed-off-by: default avatarAdam Guerin <adam.guerin@intel.com>
      Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      f99fb7d6
    • Adam Guerin's avatar
      crypto: qat - removed unused macro in adf_cnv_dbgfs.c · 9a5dcada
      Adam Guerin authored
      This macro was added but never used, remove it.
      
      This is to fix the following warning when compiling the QAT driver
      using the clang compiler with CC=clang W=2:
          drivers/crypto/intel/qat/qat_common/adf_cnv_dbgfs.c:19:9: warning: macro is not used [-Wunused-macros]
             19 | #define CNV_SLICE_ERR_MASK              GENMASK(7, 0)
                |         ^
      
      Fixes: d807f024 ("crypto: qat - add cnv_errors debugfs file")
      Signed-off-by: default avatarAdam Guerin <adam.guerin@intel.com>
      Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      9a5dcada
    • Adam Guerin's avatar
      crypto: qat - remove unused macros in qat_comp_alg.c · dfff0e35
      Adam Guerin authored
      As a result of the removal of qat_zlib_deflate, some defines where not
      removed. Remove them.
      
      This is to fix the following warning when compiling the QAT driver
      using the clang compiler with CC=clang W=2:
          drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:21:9: warning: macro is not used [-Wunused-macros]
             21 | #define QAT_RFC_1950_CM_OFFSET 4
                |         ^
          drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:16:9: warning: macro is not used [-Wunused-macros]
             16 | #define QAT_RFC_1950_HDR_SIZE 2
                |         ^
          drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:17:9: warning: macro is not used [-Wunused-macros]
             17 | #define QAT_RFC_1950_FOOTER_SIZE 4
                |         ^
          drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:22:9: warning: macro is not used [-Wunused-macros]
             22 | #define QAT_RFC_1950_DICT_MASK 0x20
                |         ^
          drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:18:9: warning: macro is not used [-Wunused-macros]
             18 | #define QAT_RFC_1950_CM_DEFLATE 8
                |         ^
          drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:20:9: warning: macro is not used [-Wunused-macros]
             20 | #define QAT_RFC_1950_CM_MASK 0x0f
                |         ^
          drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:23:9: warning: macro is not used [-Wunused-macros]
             23 | #define QAT_RFC_1950_COMP_HDR 0x785e
                |         ^
          drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:19:9: warning: macro is not used [-Wunused-macros]
             19 | #define QAT_RFC_1950_CM_DEFLATE_CINFO_32K 7
                |         ^
      
      Fixes: e9dd20e0 ("crypto: qat - Remove zlib-deflate")
      Signed-off-by: default avatarAdam Guerin <adam.guerin@intel.com>
      Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      dfff0e35
    • Dan Carpenter's avatar
      crypto: qat - uninitialized variable in adf_hb_error_inject_write() · bcc06e1b
      Dan Carpenter authored
      There are a few issues in this code.  If *ppos is non-zero then the
      first part of the buffer is not initialized.  We never initialize the
      last character of the buffer.  The return is not checked so it's
      possible that none of the buffer is initialized.
      
      This is debugfs code which is root only and the impact of these bugs is
      very small.  However, it's still worth fixing.  To fix this:
      1) Check that *ppos is zero.
      2) Use copy_from_user() instead of simple_write_to_buffer().
      3) Explicitly add a NUL terminator.
      
      Fixes: e2b67859 ("crypto: qat - add heartbeat error simulator")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      bcc06e1b
    • Mario Limonciello's avatar
      crypto: ccp - Update return values for some unit tests · 14af865b
      Mario Limonciello authored
      Until authenticated the platform enforces a state machine. Adjust
      unit tests with this in mind.
      
      Correct the return codes for all the states the unit tests ends up
      hitting:
      
      * Set Param / Get Param: DBC_ERROR_BAD_STATE
      * Set UID: DBC_ERROR_SIGNATURE_INVALID
      * Authencitated Nonce: DBC_ERROR_BAD_PARAMETERS
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      14af865b
    • Mario Limonciello's avatar
      crypto: ccp - Avoid discarding errors in psp_send_platform_access_msg() · 0e8fca2f
      Mario Limonciello authored
      Errors can potentially occur in the "processing" of PSP commands or
      commands can be processed successfully but still return an error code in
      the header.
      
      This second case was being discarded because PSP communication worked but
      the command returned an error code in the payload header.
      
      Capture both cases and return them to the caller as -EIO for the caller
      to investigate. The caller can detect the latter by looking at
      `req->header->status`.
      Reported-and-tested-by: default avatarTim Van Patten <timvp@google.com>
      Fixes: 7ccc4f4e ("crypto: ccp - Add support for an interface for platform features")
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0e8fca2f
    • Arnd Bergmann's avatar
      crypto: arm/sha - fix function cast warnings · 53cc9bae
      Arnd Bergmann authored
      clang-16 warns about casting between incompatible function types:
      
      arch/arm/crypto/sha256_glue.c:37:5: error: cast from 'void (*)(u32 *, const void *, unsigned int)' (aka 'void (*)(unsigned int *, const void *, unsigned int)') to 'sha256_block_fn *' (aka 'void (*)(struct sha256_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
         37 |                                 (sha256_block_fn *)sha256_block_data_order);
            |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      arch/arm/crypto/sha512-glue.c:34:3: error: cast from 'void (*)(u64 *, const u8 *, int)' (aka 'void (*)(unsigned long long *, const unsigned char *, int)') to 'sha512_block_fn *' (aka 'void (*)(struct sha512_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
         34 |                 (sha512_block_fn *)sha512_block_data_order);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Fix the prototypes for the assembler functions to match the typedef.
      The code already relies on the digest being the first part of the
      state structure, so there is no change in behavior.
      
      Fixes: c80ae7ca ("crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON")
      Fixes: b59e2ae3 ("crypto: arm/sha256 - move SHA-224/256 ASM/NEON implementation to base layer")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      53cc9bae
    • Giovanni Cabiddu's avatar
      Documentation: qat: fix auto_reset section · 2ecd4341
      Giovanni Cabiddu authored
      Remove unneeded colon in the auto_reset section.
      
      This resolves the following errors when building the documentation:
      
          Documentation/ABI/testing/sysfs-driver-qat:146: ERROR: Unexpected indentation.
          Documentation/ABI/testing/sysfs-driver-qat:146: WARNING: Block quote ends without a blank line; unexpected unindent.
      
      Fixes: f5419a42 ("crypto: qat - add auto reset on error")
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Closes: https://lore.kernel.org/linux-kernel/20240212144830.70495d07@canb.auug.org.au/T/Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2ecd4341
  2. 17 Feb, 2024 7 commits
  3. 09 Feb, 2024 12 commits
  4. 02 Feb, 2024 5 commits
  5. 26 Jan, 2024 7 commits