* Out-of-bound access in sysrq
@ 2013-03-28 10:34 Jiri Slaby
2013-03-28 13:19 ` Mathieu Poirier
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2013-03-28 10:34 UTC (permalink / raw)
To: Linus Torvalds, mathieu.poirier; +Cc: LKML, Dmitry Torokhov
Guys,
how is this supposed to work?
#define SYSRQ_KEY_RESET_MAX 20 /* Should be plenty */
static unsigned short sysrq_reset_seq[SYSRQ_KEY_RESET_MAX];
...
unsigned short platform_sysrq_reset_seq[] __weak = { KEY_RESERVED };
...
static inline void sysrq_register_handler(void)
{
...
for (i = 0; i < ARRAY_SIZE(sysrq_reset_seq); i++) {
key = platform_sysrq_reset_seq[i];
if (key == KEY_RESERVED || key > KEY_MAX)
...
i runs from 0 to 19 incl., but platform_sysrq_reset_seq, if not
overriden, is of size 1, so?
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Out-of-bound access in sysrq
2013-03-28 10:34 Out-of-bound access in sysrq Jiri Slaby
@ 2013-03-28 13:19 ` Mathieu Poirier
2013-03-28 13:28 ` Jiri Slaby
0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Poirier @ 2013-03-28 13:19 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Linus Torvalds, LKML, Dmitry Torokhov
On 13-03-28 04:34 AM, Jiri Slaby wrote:
> Guys,
>
> how is this supposed to work?
>
> #define SYSRQ_KEY_RESET_MAX 20 /* Should be plenty */
> static unsigned short sysrq_reset_seq[SYSRQ_KEY_RESET_MAX];
> ...
> unsigned short platform_sysrq_reset_seq[] __weak = { KEY_RESERVED };
> ...
> static inline void sysrq_register_handler(void)
> {
> ...
> for (i = 0; i < ARRAY_SIZE(sysrq_reset_seq); i++) {
> key = platform_sysrq_reset_seq[i];
> if (key == KEY_RESERVED || key > KEY_MAX)
> ...
>
>
>
>
> i runs from 0 to 19 incl., but platform_sysrq_reset_seq, if not
> overriden, is of size 1, so?
>
> thanks,
>
Unless I'm missing something, 'i' won't go higher than '0' since the
first element of platform_sysrq_reset_seq is set to KEY_RESERVED and in
such case the 'break' is executed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Out-of-bound access in sysrq
2013-03-28 13:19 ` Mathieu Poirier
@ 2013-03-28 13:28 ` Jiri Slaby
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2013-03-28 13:28 UTC (permalink / raw)
To: Mathieu Poirier; +Cc: Linus Torvalds, LKML, Dmitry Torokhov
On 03/28/2013 02:19 PM, Mathieu Poirier wrote:
> On 13-03-28 04:34 AM, Jiri Slaby wrote:
>> Guys,
>>
>> how is this supposed to work?
>>
>> #define SYSRQ_KEY_RESET_MAX 20 /* Should be plenty */
>> static unsigned short sysrq_reset_seq[SYSRQ_KEY_RESET_MAX];
>> ...
>> unsigned short platform_sysrq_reset_seq[] __weak = { KEY_RESERVED };
>> ...
>> static inline void sysrq_register_handler(void)
>> {
>> ...
>> for (i = 0; i < ARRAY_SIZE(sysrq_reset_seq); i++) {
>> key = platform_sysrq_reset_seq[i];
>> if (key == KEY_RESERVED || key > KEY_MAX)
>> ...
>>
>>
>>
>>
>> i runs from 0 to 19 incl., but platform_sysrq_reset_seq, if not
>> overriden, is of size 1, so?
>>
>> thanks,
>>
>
> Unless I'm missing something, 'i' won't go higher than '0' since the
> first element of platform_sysrq_reset_seq is set to KEY_RESERVED and in
> such case the 'break' is executed.
Of course, I was apparently sleeping yet. Sorry for the noise!
--
js
suse labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-28 13:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-28 10:34 Out-of-bound access in sysrq Jiri Slaby
2013-03-28 13:19 ` Mathieu Poirier
2013-03-28 13:28 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).