Skip to content

Commit 917167e

Browse files
committed
Merge tag 'xtensa-20251010' of https://github.com/jcmvbkbc/linux-xtensa
Pull Xtensa updates from Max Filippov: - minor cleanups * tag 'xtensa-20251010' of https://github.com/jcmvbkbc/linux-xtensa: xtensa: use HZ_PER_MHZ in platform_calibrate_ccount xtensa: simdisk: add input size check in proc_write_simdisk
2 parents 1b1391b + 4c8bad3 commit 917167e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

arch/xtensa/kernel/platform.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <linux/printk.h>
1616
#include <linux/types.h>
17+
#include <linux/units.h>
1718
#include <asm/platform.h>
1819
#include <asm/timex.h>
1920

@@ -38,7 +39,7 @@ void __weak platform_idle(void)
3839
#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
3940
void __weak platform_calibrate_ccount(void)
4041
{
41-
pr_err("ERROR: Cannot calibrate cpu frequency! Assuming 10MHz.\n");
42-
ccount_freq = 10 * 1000000UL;
42+
pr_err("ERROR: Cannot calibrate cpu frequency! Assuming 10 MHz.\n");
43+
ccount_freq = 10 * HZ_PER_MHZ;
4344
}
4445
#endif

arch/xtensa/platforms/iss/simdisk.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,14 @@ static ssize_t proc_read_simdisk(struct file *file, char __user *buf,
231231
static ssize_t proc_write_simdisk(struct file *file, const char __user *buf,
232232
size_t count, loff_t *ppos)
233233
{
234-
char *tmp = memdup_user_nul(buf, count);
234+
char *tmp;
235235
struct simdisk *dev = pde_data(file_inode(file));
236236
int err;
237237

238+
if (count == 0 || count > PAGE_SIZE)
239+
return -EINVAL;
240+
241+
tmp = memdup_user_nul(buf, count);
238242
if (IS_ERR(tmp))
239243
return PTR_ERR(tmp);
240244

0 commit comments

Comments
 (0)