* Re: [PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info
2017-02-22 7:20 ` [PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info Pranay Kr. Srivastava
@ 2017-02-22 10:26 ` Samuel Thibault
2017-02-24 15:32 ` kbuild test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2017-02-22 10:26 UTC (permalink / raw)
To: Pranay Kr. Srivastava
Cc: w.d.hubbs, chris, kirk, gregkh, sfr, speakup, devel, linux-kernel
Pranay Kr. Srivastava, on mer. 22 févr. 2017 12:50:26 +0530, wrote:
> This patch makes spk_set_key_info return -EINVAL
> in case of failure instead of returning 4 different
> values for the type of error that occurred.
>
> Print the offending values instead as debug message.
>
> Signed-off-by: Pranay Kr. Srivastava <pranjas@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> drivers/staging/speakup/main.c | 27 +++++++++++++++++++--------
> 1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index c2f70ef..6667cf2 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1216,13 +1216,19 @@ int spk_set_key_info(const u_char *key_info, u_char *k_buffer)
> u_char ch, version, num_keys;
>
> version = *cp++;
> - if (version != KEY_MAP_VER)
> - return -1;
> + if (version != KEY_MAP_VER) {
> + pr_debug("version found %d should be %d\n",
> + version, KEY_MAP_VER);
> + return -EINVAL;
> + }
> num_keys = *cp;
> states = (int)cp[1];
> key_data_len = (states + 1) * (num_keys + 1);
> - if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf))
> - return -2;
> + if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
> + pr_debug("too many key_infos (%d over %lu)\n",
> + key_data_len + SHIFT_TBL_SIZE + 4, sizeof(spk_key_buf));
> + return -EINVAL;
> + }
> memset(k_buffer, 0, SHIFT_TBL_SIZE);
> memset(spk_our_keys, 0, sizeof(spk_our_keys));
> spk_shift_table = k_buffer;
> @@ -1233,14 +1239,19 @@ int spk_set_key_info(const u_char *key_info, u_char *k_buffer)
> cp1 += 2; /* now pointing at shift states */
> for (i = 1; i <= states; i++) {
> ch = *cp1++;
> - if (ch >= SHIFT_TBL_SIZE)
> - return -3;
> + if (ch >= SHIFT_TBL_SIZE) {
> + pr_debug("(%d) not valid shift state (max_allowed = %d)\n", ch,
> + SHIFT_TBL_SIZE);
> + return -EINVAL;
> + }
> spk_shift_table[ch] = i;
> }
> keymap_flags = *cp1++;
> while ((ch = *cp1)) {
> - if (ch >= MAX_KEY)
> - return -4;
> + if (ch >= MAX_KEY) {
> + pr_debug("(%d), not valid key, (max_allowed = %d)\n", ch, MAX_KEY);
> + return -EINVAL;
> + }
> spk_our_keys[ch] = cp1;
> cp1 += states + 1;
> }
> --
> 2.10.2
>
--
Samuel
<b> j'en ai parlé à xavier, il n'est pas interdit qu'il le change un jour
-+- #sos - a le bras long vers le chameau -+-
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info
2017-02-22 7:20 ` [PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info Pranay Kr. Srivastava
2017-02-22 10:26 ` Samuel Thibault
@ 2017-02-24 15:32 ` kbuild test robot
2017-02-24 17:32 ` Greg KH
2017-02-28 12:13 ` kbuild test robot
3 siblings, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2017-02-24 15:32 UTC (permalink / raw)
To: Pranay Kr. Srivastava
Cc: kbuild-all, w.d.hubbs, chris, kirk, samuel.thibault, gregkh, sfr,
speakup, devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4045 bytes --]
Hi Pranay,
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.10]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Pranay-Kr-Srivastava/return-same-error-value-from-spk_set_key_info/20170222-152440
config: i386-randconfig-c0-02242210 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/linux/dynamic_debug.h:5:0,
from include/linux/printk.h:320,
from include/linux/kernel.h:13,
from drivers/staging/speakup/main.c:21:
drivers/staging/speakup/main.c: In function 'spk_set_key_info':
>> include/linux/jump_label.h:377:59: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
else if (__builtin_types_compatible_p(typeof(*x), struct static_key_false)) \
^
>> include/linux/dynamic_debug.h:102:2: note: in expansion of macro 'static_branch_unlikely'
static_branch_unlikely(&descriptor.key.dd_key_false)
^
>> include/linux/dynamic_debug.h:125:6: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
if (DYNAMIC_DEBUG_BRANCH(descriptor)) \
^
include/linux/printk.h:324:2: note: in expansion of macro 'dynamic_pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^
drivers/staging/speakup/main.c:1228:3: note: in expansion of macro 'pr_debug'
pr_debug("too many key_infos (%d over %lu)\n",
^
vim +377 include/linux/jump_label.h
11276d53 Peter Zijlstra 2015-07-24 361 ({ \
11276d53 Peter Zijlstra 2015-07-24 362 bool branch; \
11276d53 Peter Zijlstra 2015-07-24 363 if (__builtin_types_compatible_p(typeof(*x), struct static_key_true)) \
11276d53 Peter Zijlstra 2015-07-24 364 branch = !arch_static_branch(&(x)->key, true); \
11276d53 Peter Zijlstra 2015-07-24 365 else if (__builtin_types_compatible_p(typeof(*x), struct static_key_false)) \
11276d53 Peter Zijlstra 2015-07-24 366 branch = !arch_static_branch_jump(&(x)->key, true); \
11276d53 Peter Zijlstra 2015-07-24 367 else \
11276d53 Peter Zijlstra 2015-07-24 368 branch = ____wrong_branch_error(); \
11276d53 Peter Zijlstra 2015-07-24 369 branch; \
11276d53 Peter Zijlstra 2015-07-24 370 })
11276d53 Peter Zijlstra 2015-07-24 371
11276d53 Peter Zijlstra 2015-07-24 372 #define static_branch_unlikely(x) \
11276d53 Peter Zijlstra 2015-07-24 373 ({ \
11276d53 Peter Zijlstra 2015-07-24 374 bool branch; \
11276d53 Peter Zijlstra 2015-07-24 375 if (__builtin_types_compatible_p(typeof(*x), struct static_key_true)) \
11276d53 Peter Zijlstra 2015-07-24 376 branch = arch_static_branch_jump(&(x)->key, false); \
11276d53 Peter Zijlstra 2015-07-24 @377 else if (__builtin_types_compatible_p(typeof(*x), struct static_key_false)) \
11276d53 Peter Zijlstra 2015-07-24 378 branch = arch_static_branch(&(x)->key, false); \
11276d53 Peter Zijlstra 2015-07-24 379 else \
11276d53 Peter Zijlstra 2015-07-24 380 branch = ____wrong_branch_error(); \
11276d53 Peter Zijlstra 2015-07-24 381 branch; \
11276d53 Peter Zijlstra 2015-07-24 382 })
11276d53 Peter Zijlstra 2015-07-24 383
11276d53 Peter Zijlstra 2015-07-24 384 #else /* !HAVE_JUMP_LABEL */
11276d53 Peter Zijlstra 2015-07-24 385
:::::: The code at line 377 was first introduced by commit
:::::: 11276d5306b8e5b438a36bbff855fe792d7eaa61 locking/static_keys: Add a new static_key interface
:::::: TO: Peter Zijlstra <peterz@infradead.org>
:::::: CC: Ingo Molnar <mingo@kernel.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26365 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info
2017-02-22 7:20 ` [PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info Pranay Kr. Srivastava
2017-02-22 10:26 ` Samuel Thibault
2017-02-24 15:32 ` kbuild test robot
@ 2017-02-24 17:32 ` Greg KH
2017-02-28 12:13 ` kbuild test robot
3 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2017-02-24 17:32 UTC (permalink / raw)
To: Pranay Kr. Srivastava
Cc: w.d.hubbs, chris, kirk, samuel.thibault, sfr, speakup, devel,
linux-kernel
On Wed, Feb 22, 2017 at 12:50:26PM +0530, Pranay Kr. Srivastava wrote:
> This patch makes spk_set_key_info return -EINVAL
> in case of failure instead of returning 4 different
> values for the type of error that occurred.
>
> Print the offending values instead as debug message.
>
> Signed-off-by: Pranay Kr. Srivastava <pranjas@gmail.com>
> ---
> drivers/staging/speakup/main.c | 27 +++++++++++++++++++--------
> 1 file changed, 19 insertions(+), 8 deletions(-)
Please fix the build errors and resend this series.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info
2017-02-22 7:20 ` [PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info Pranay Kr. Srivastava
` (2 preceding siblings ...)
2017-02-24 17:32 ` Greg KH
@ 2017-02-28 12:13 ` kbuild test robot
3 siblings, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2017-02-28 12:13 UTC (permalink / raw)
To: Pranay Kr. Srivastava
Cc: kbuild-all, w.d.hubbs, chris, kirk, samuel.thibault, gregkh, sfr,
speakup, devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4363 bytes --]
Hi Pranay,
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.10 next-20170228]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Pranay-Kr-Srivastava/return-same-error-value-from-spk_set_key_info/20170222-152440
config: i386-randconfig-c0-02281459 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/linux/linkage.h:4:0,
from include/linux/kernel.h:6,
from drivers/staging/speakup/main.c:21:
drivers/staging/speakup/main.c: In function 'spk_set_key_info':
>> include/linux/compiler.h:117:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
static struct ftrace_branch_data \
^
include/linux/compiler.h:160:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^
include/linux/dynamic_debug.h:125:2: note: in expansion of macro 'if'
if (DYNAMIC_DEBUG_BRANCH(descriptor)) \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
include/linux/dynamic_debug.h:117:2: note: in expansion of macro 'unlikely'
unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)
^
include/linux/dynamic_debug.h:125:6: note: in expansion of macro 'DYNAMIC_DEBUG_BRANCH'
if (DYNAMIC_DEBUG_BRANCH(descriptor)) \
^
include/linux/printk.h:324:2: note: in expansion of macro 'dynamic_pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^
drivers/staging/speakup/main.c:1228:3: note: in expansion of macro 'pr_debug'
pr_debug("too many key_infos (%d over %lu)\n",
^
vim +117 include/linux/compiler.h
2bcd521a Steven Rostedt 2008-11-21 101 };
2bcd521a Steven Rostedt 2008-11-21 102 };
2ed84eeb Steven Rostedt 2008-11-12 103
2ed84eeb Steven Rostedt 2008-11-12 104 /*
2ed84eeb Steven Rostedt 2008-11-12 105 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
2ed84eeb Steven Rostedt 2008-11-12 106 * to disable branch tracing on a per file basis.
2ed84eeb Steven Rostedt 2008-11-12 107 */
d9ad8bc0 Bart Van Assche 2009-04-05 108 #if defined(CONFIG_TRACE_BRANCH_PROFILING) \
d9ad8bc0 Bart Van Assche 2009-04-05 109 && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
2ed84eeb Steven Rostedt 2008-11-12 110 void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
1f0d69a9 Steven Rostedt 2008-11-12 111
1f0d69a9 Steven Rostedt 2008-11-12 112 #define likely_notrace(x) __builtin_expect(!!(x), 1)
1f0d69a9 Steven Rostedt 2008-11-12 113 #define unlikely_notrace(x) __builtin_expect(!!(x), 0)
1f0d69a9 Steven Rostedt 2008-11-12 114
45b79749 Steven Rostedt 2008-11-21 115 #define __branch_check__(x, expect) ({ \
1f0d69a9 Steven Rostedt 2008-11-12 116 int ______r; \
2ed84eeb Steven Rostedt 2008-11-12 @117 static struct ftrace_branch_data \
1f0d69a9 Steven Rostedt 2008-11-12 118 __attribute__((__aligned__(4))) \
45b79749 Steven Rostedt 2008-11-21 119 __attribute__((section("_ftrace_annotated_branch"))) \
1f0d69a9 Steven Rostedt 2008-11-12 120 ______f = { \
1f0d69a9 Steven Rostedt 2008-11-12 121 .func = __func__, \
1f0d69a9 Steven Rostedt 2008-11-12 122 .file = __FILE__, \
1f0d69a9 Steven Rostedt 2008-11-12 123 .line = __LINE__, \
1f0d69a9 Steven Rostedt 2008-11-12 124 }; \
1f0d69a9 Steven Rostedt 2008-11-12 125 ______r = likely_notrace(x); \
:::::: The code at line 117 was first introduced by commit
:::::: 2ed84eeb8808cf3c9f039213ca137ffd7d753f0e trace: rename unlikely profiler to branch profiler
:::::: TO: Steven Rostedt <srostedt@redhat.com>
:::::: CC: Ingo Molnar <mingo@elte.hu>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27857 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread