[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 11/15] hw/sd/sdcard: Constify sd_crc*()'s message argument
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v5 11/15] hw/sd/sdcard: Constify sd_crc*()'s message argument |
Date: |
Fri, 26 Jun 2020 18:40:22 +0200 |
CRC functions don't modify the buffer argument,
make it const.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/sd/sd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 115a5aa4c3..486538afc2 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -255,11 +255,11 @@ static const int sd_cmd_class[SDMMC_CMD_MAX] = {
7, 7, 10, 7, 9, 9, 9, 8, 8, 10, 8, 8, 8, 8, 8, 8,
};
-static uint8_t sd_crc7(void *message, size_t width)
+static uint8_t sd_crc7(const void *message, size_t width)
{
int i, bit;
uint8_t shift_reg = 0x00;
- uint8_t *msg = (uint8_t *) message;
+ const uint8_t *msg = (const uint8_t *)message;
for (i = 0; i < width; i ++, msg ++)
for (bit = 7; bit >= 0; bit --) {
@@ -271,11 +271,11 @@ static uint8_t sd_crc7(void *message, size_t width)
return shift_reg;
}
-static uint16_t sd_crc16(void *message, size_t width)
+static uint16_t sd_crc16(const void *message, size_t width)
{
int i, bit;
uint16_t shift_reg = 0x0000;
- uint16_t *msg = (uint16_t *) message;
+ const uint16_t *msg = (const uint16_t *)message;
width <<= 1;
for (i = 0; i < width; i ++, msg ++)
--
2.21.3
- [PATCH v5 00/15] hw/sd/sdcard: Fix CVE-2020-13253 & cleanups, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 04/15] hw/sd/sdcard: Use the HWBLOCK_SIZE definition, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 02/15] hw/sd/sdcard: Update coding style to make checkpatch.pl happy, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 03/15] hw/sd/sdcard: Move some definitions to use them earlier, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 01/15] MAINTAINERS: Cc qemu-block mailing list, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 08/15] hw/sd/sdcard: Check address is in range, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 05/15] hw/sd/sdcard: Do not switch to ReceivingData if address is invalid, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 06/15] hw/sd/sdcard: Restrict Class 6 commands to SCSD cards, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 11/15] hw/sd/sdcard: Constify sd_crc*()'s message argument,
Philippe Mathieu-Daudé <=
- [PATCH v5 14/15] hw/sd/sdcard: Display offset in read/write_data() trace events, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 07/15] hw/sd/sdcard: Initialize constant values first, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 09/15] hw/sd/sdcard: Update the SDState documentation, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 10/15] hw/sd/sdcard: Simplify cmd_valid_while_locked(), Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 13/15] hw/sd/sdcard: Correctly display the command name in trace events, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 12/15] hw/sd/sdcard: Make iolen unsigned, Philippe Mathieu-Daudé, 2020/06/26
- [PATCH v5 15/15] hw/sd/sdcard: Simplify realize() a bit, Philippe Mathieu-Daudé, 2020/06/26
- Re: [PATCH v5 00/15] hw/sd/sdcard: Fix CVE-2020-13253 & cleanups, no-reply, 2020/06/26