cpufreq: imx6q: add return value check for voltage scale
Subsystems (6)
Sasha Levin
maintainerPATCH 1/7 cpufreq: imx6q: add return value check for voltage scale
From: Anson Huang <[email protected]>
[ Upstream commit 6ef28a04d1ccf718eee069b72132ce4aa1e52ab9 ]
Add return value check for voltage scale when ARM clock rate change fail.
--- drivers/cpufreq/imx6q-cpufreq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/cpufreq/imx6q-cpufreq.c +6 -1
@@ -105,8 +105,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)/* Ensure the arm clock divider is what we expect */ ret =clk_set_rate (arm_clk, new_freq *1000 );if (ret) { +int ret1; +dev_err (cpu_dev,"failed to set clock rate: %d\n" , ret); -regulator_set_voltage_tol (arm_reg, volt_old,0 ); + ret1 =regulator_set_voltage_tol (arm_reg, volt_old,0 ); +if (ret1) +dev_warn (cpu_dev, +"failed to restore vddarm voltage: %d\n" , ret1);return ret; }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 2/7 ARM: make lookup_processor_type() non-__init
From: Russell King <[email protected]>
[ Upstream commit 899a42f836678a595f7d2bc36a5a0c2b03d08cbc ]
Move lookup_processor_type() out of the __init section so it is callable from (eg) the secondary startup code during hotplug.
--- arch/arm/kernel/head-common.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/kernel/head-common.S +3 -3
@@ -122,6 +122,9 @@ __mmap_switched_data: .long init_thread_union + THREAD_START_SP @ sp .size __mmap_switched_data, . - __mmap_switched_data + __FINIT + .text + /* * This provides a C-API version of __lookup_processor_type */
@@ -133,9 +136,6 @@ ENTRY(lookup_processor_type) ldmfd sp!, {r4 - r6, r9, pc} ENDPROC(lookup_processor_type) - __FINIT - .text - /* * Read processor ID register (CP#15, CR0), and look up in the linker-built * supported processor list. Note that we can't use the absolute addresses
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 3/7 ARM: split out processor lookup
In reply to Sasha LevinFrom: Russell King <[email protected]>
[ Upstream commit 65987a8553061515b5851b472081aedb9837a391 ]
Split out the lookup of the processor type and associated error handling from the rest of setup_processor() - we will need to use this in the secondary CPU bringup path for big.Little Spectre variant 2 mitigation.
--- arch/arm/include/asm/cputype.h | 1 + arch/arm/kernel/setup.c | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-)
arch/arm/include/asm/cputype.h +1 -0
@@ -82,6 +82,7 @@#define ARM_CPU_XSCALE_ARCH_V3 0x6000extern unsigned int processor_id; +struct proc_info_list *lookup_processor (u32 midr);#ifdef CONFIG_CPU_CP15 #define read_cpuid (reg) \
arch/arm/kernel/setup.c +19 -12
@@ -578,22 +578,29 @@ static void __init smp_build_mpidr_hash(void) }#endif -static void __init setup_processor (void ) +/* +* locate processor in the list of supported processor types. The linker +* builds this table for us from the entries in arch/arm/mm/proc-*.S +*/ +struct proc_info_list *lookup_processor (u32 midr) { -struct proc_info_list *list; +struct proc_info_list *list =lookup_processor_type (midr); -/* -* locate processor in the list of supported processor -* types. The linker builds this table for us from the -* entries in arch/arm/mm/proc-*.S -*/ - list =lookup_processor_type (read_cpuid_id ());if (!list) { -pr_err ("CPU configuration botched (ID %08x), unable to continue.\n" , -read_cpuid_id ()); -while (1 ); +pr_err ("CPU%u: configuration botched (ID %08x), CPU halted\n" , +smp_processor_id (), midr); +while (1 ) +/* can't use cpu_relax() here as it may require MMU setup */ ; } +return list; +} + +static void __init setup_processor (void ) +{ +unsigned int midr =read_cpuid_id (); +struct proc_info_list *list =lookup_processor (midr); + cpu_name = list->cpu_name; __cpu_architecture =__get_cpu_architecture ();
@@ -611,7 +618,7 @@ static void __init setup_processor(void)#endif pr_info ("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n" , - cpu_name,read_cpuid_id (),read_cpuid_id () &15 , + list->cpu_name, midr, midr &15 , proc_arch[cpu_architecture ()],get_cr ()); snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c",
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 4/7 SUNRPC: Fix a bogus get/put in generic_key_to_expire()
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit e3d5e573a54dabdc0f9f3cb039d799323372b251 ]
--- net/sunrpc/auth_generic.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
net/sunrpc/auth_generic.c +1 -7
@@ -272,13 +272,7 @@ static bool generic_key_to_expire(struct rpc_cred *cred) { struct auth_cred *acred = &container_of(cred, struct generic_cred, gc_base)->acred; -bool ret; - -get_rpccred (cred); - ret =test_bit (RPC_CRED_KEY_EXPIRE_SOON , &acred->ac_flags); -put_rpccred (cred); - -return ret; +return test_bit (RPC_CRED_KEY_EXPIRE_SOON , &acred->ac_flags); }static const struct rpc_credops generic_credops = {
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 5/7 kdb: Use strscpy with destination buffer size
In reply to Sasha LevinFrom: Prarit Bhargava <[email protected]>
[ Upstream commit c2b94c72d93d0929f48157eef128c4f9d2e603ce ]
gcc 8.1.0 warns with:
kernel/debug/kdb/kdb_support.c: In function ‘kallsyms_symbol_next’:kernel/debug/kdb/kdb_support.c:239:4: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy(prefix_name, name, strlen(name)+1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~kernel/debug/kdb/kdb_support.c:239:31: note: length computed here
Use strscpy() with the destination buffer size, and use ellipses when displaying truncated symbols.
v2: Use strscpy()
--- kernel/debug/kdb/kdb_io.c | 15 +++++++++------ kernel/debug/kdb/kdb_private.h | 2 +- kernel/debug/kdb/kdb_support.c | 10 +++++----- 3 files changed, 15 insertions(+), 12 deletions(-)
kernel/debug/kdb/kdb_io.c +9 -6
@@ -215,7 +215,7 @@ static char *kdb_read(char *buffer, size_t bufsize)int count;int i;int diag, dtab_count; -int key; +int key, buf_size, ret; diag =kdbgetintenv ("DTABCOUNT" , &dtab_count);
@@ -335,9 +335,8 @@ static char *kdb_read(char *buffer, size_t bufsize)else p_tmp = tmpbuffer; len =strlen (p_tmp); - count =kallsyms_symbol_complete (p_tmp, -sizeof (tmpbuffer) - - (p_tmp - tmpbuffer)); + buf_size =sizeof (tmpbuffer) - (p_tmp - tmpbuffer); + count =kallsyms_symbol_complete (p_tmp, buf_size);if (tab ==2 && count >0 ) {kdb_printf ("\n%d symbols are found." , count);if (count > dtab_count) {
@@ -349,9 +348,13 @@ static char *kdb_read(char *buffer, size_t bufsize) }kdb_printf ("\n" );for (i =0 ; i < count; i++) { -if (WARN_ON (!kallsyms_symbol_next (p_tmp, i))) + ret =kallsyms_symbol_next (p_tmp, i, buf_size); +if (WARN_ON (!ret))break ; -kdb_printf ("%s " , p_tmp); +if (ret != -E2BIG ) +kdb_printf ("%s " , p_tmp); +else +kdb_printf ("%s... " , p_tmp); *(p_tmp + len) ='\0' ; }if (i >= dtab_count)
kernel/debug/kdb/kdb_private.h +1 -1
@@ -83,7 +83,7 @@ typedef struct __ksymtab {unsigned long sym_start;unsigned long sym_end; } kdb_symtab_t; -extern int kallsyms_symbol_next (char *prefix_name,int flag); +extern int kallsyms_symbol_next (char *prefix_name,int flag,int buf_size);extern int kallsyms_symbol_complete (char *prefix_name,int max_len);/* Exported Symbols for kernel loadable modules to use. */
kernel/debug/kdb/kdb_support.c +5 -5
@@ -221,11 +221,13 @@ int kallsyms_symbol_complete(char *prefix_name, int max_len)* Parameters: * prefix_name prefix of a symbol name to lookup * flag 0 means search from the head, 1 means continue search. +* buf_size maximum length that can be written to prefix_name +* buffer * Returns: * 1 if a symbol matches the given prefix. * 0 if no string found */ -int kallsyms_symbol_next (char *prefix_name,int flag) +int kallsyms_symbol_next (char *prefix_name,int flag,int buf_size) {int prefix_len =strlen (prefix_name);static loff_t pos;
@@ -235,10 +237,8 @@ int kallsyms_symbol_next(char *prefix_name, int flag) pos =0 ;while ((name =kdb_walk_kallsyms (&pos))) { -if (strncmp (name, prefix_name, prefix_len) ==0 ) { -strncpy (prefix_name, name,strlen (name)+1 ); -return 1 ; - } +if (!strncmp (name, prefix_name, prefix_len)) +return strscpy (prefix_name, name, buf_size); }return 0 ; }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 6/7 powerpc/numa: Suppress "VPHN is not supported" messages
In reply to Sasha LevinFrom: Satheesh Rajendran <[email protected]>
[ Upstream commit 437ccdc8ce629470babdda1a7086e2f477048cbd ]
When VPHN function is not supported and during cpu hotplug event, kernel prints message 'VPHN function not supported. Disabling polling...'. Currently it prints on every hotplug event, it floods dmesg when a KVM guest tries to hotplug huge number of vcpus, let's just print once and suppress further kernel prints.
--- arch/powerpc/mm/numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/numa.c +1 -1
@@ -1479,7 +1479,7 @@ static long vphn_get_associativity(unsigned long cpu,switch (rc) {case H_FUNCTION : -printk (KERN_INFO +printk_once (KERN_INFO "VPHN is not supported. Disabling polling...\n" );stop_topology_update ();break ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 7/7 tmpfs: make lseek(SEEK_DATA/SEK_HOLE) return ENXIO with a negative offset
In reply to Sasha LevinFrom: Yufen Yu <[email protected]>
[ Upstream commit 1a413646931cb14442065cfc17561e50f5b5bb44 ]
Other filesystems such as ext4, f2fs and ubifs all return ENXIO when lseek (SEEK_DATA or SEEK_HOLE) requests a negative offset.
man 2 lseek says
: EINVAL whence is not valid. Or: the resulting file offset would be
: negative, or beyond the end of a seekable device.
:
: ENXIO whence is SEEK_DATA or SEEK_HOLE, and the file offset is beyond
: the end of the file.
Make tmpfs return ENXIO under these circumstances as well. After this, tmpfs also passes xfstests's generic/448.
--- mm/shmem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mm/shmem.c +1 -3
@@ -1805,9 +1805,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence)mutex_lock (&inode->i_mutex);/* We're holding i_mutex so we can access i_size directly */ -if (offset <0 ) - offset = -EINVAL ; -else if (offset >= inode->i_size) +if (offset <0 || offset >= inode->i_size) offset = -ENXIO ;else { start = offset >>PAGE_CACHE_SHIFT ;
Signature · 1 line
2.17.1