diff options
author | Arnd Bergmann <arnd@arndb.de> | 2023-04-14 14:12:05 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2023-04-14 14:12:06 +0200 |
commit | 5d2e8343e412798fbf182a3928c5a776fa6a0f64 (patch) | |
tree | 7d8774b7540f4ac75b9ecb82f856d81131c3262b /drivers/soc | |
parent | 283480f0ce9ac234bce4d8ad4654372a37c1d4d3 (diff) | |
parent | bdfe6de2695c5bccc663a5a7d530f81925d8bc10 (diff) |
Merge tag 'asahi-soc-rtkit-6.4' of https://github.com/AsahiLinux/linux into soc/drivers
Apple SoC RTKit updates for 6.4.
Just one bugfix and one improvement to how forwarded syslogs are sent to
dmesg.
* tag 'asahi-soc-rtkit-6.4' of https://github.com/AsahiLinux/linux:
soc: apple: rtkit: Crop syslog messages
soc: apple: rtkit: Fix buffer address field width
Link: https://lore.kernel.org/r/0dbd2dc1-6a2c-5b21-354b-d8314937e8e7@marcan.st
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/soc')
-rw-r--r-- | drivers/soc/apple/rtkit.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c index 35ec35aa500d..d9f19dc99da5 100644 --- a/drivers/soc/apple/rtkit.c +++ b/drivers/soc/apple/rtkit.c @@ -55,7 +55,7 @@ enum { #define APPLE_RTKIT_BUFFER_REQUEST 1 #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK_ULL(51, 44) -#define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK_ULL(41, 0) +#define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK_ULL(43, 0) #define APPLE_RTKIT_SYSLOG_TYPE GENMASK_ULL(59, 52) @@ -409,11 +409,17 @@ static void apple_rtkit_syslog_rx_init(struct apple_rtkit *rtk, u64 msg) rtk->syslog_n_entries, rtk->syslog_msg_size); } +static bool should_crop_syslog_char(char c) +{ + return c == '\n' || c == '\r' || c == ' ' || c == '\0'; +} + static void apple_rtkit_syslog_rx_log(struct apple_rtkit *rtk, u64 msg) { u8 idx = msg & 0xff; char log_context[24]; size_t entry_size = 0x20 + rtk->syslog_msg_size; + int msglen; if (!rtk->syslog_msg_buffer) { dev_warn( @@ -446,7 +452,13 @@ static void apple_rtkit_syslog_rx_log(struct apple_rtkit *rtk, u64 msg) rtk->syslog_msg_size); log_context[sizeof(log_context) - 1] = 0; - rtk->syslog_msg_buffer[rtk->syslog_msg_size - 1] = 0; + + msglen = rtk->syslog_msg_size - 1; + while (msglen > 0 && + should_crop_syslog_char(rtk->syslog_msg_buffer[msglen - 1])) + msglen--; + + rtk->syslog_msg_buffer[msglen] = 0; dev_info(rtk->dev, "RTKit: syslog message: %s: %s\n", log_context, rtk->syslog_msg_buffer); |