trace: fix pointer cross the border
Fix pointer cross the border Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
This commit is contained in:
parent
d868387148
commit
e3df21cd4c
@ -485,29 +485,32 @@ static int trace_cmd_switch(int index, int argc, FAR char **argv,
|
|||||||
|
|
||||||
/* Parse the setting parameters */
|
/* Parse the setting parameters */
|
||||||
|
|
||||||
if (argv[index][0] == '-' || argv[index][0] == '+')
|
if (index < argc)
|
||||||
{
|
{
|
||||||
enable = (argv[index][0] == '+');
|
if (argv[index][0] == '-' || argv[index][0] == '+')
|
||||||
if (enable ==
|
|
||||||
((mode.flag & NOTE_FILTER_MODE_FLAG_SWITCH) != 0))
|
|
||||||
{
|
{
|
||||||
/* Already set */
|
enable = (argv[index][0] == '+');
|
||||||
|
if (enable ==
|
||||||
|
((mode.flag & NOTE_FILTER_MODE_FLAG_SWITCH) != 0))
|
||||||
|
{
|
||||||
|
/* Already set */
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
mode.flag |= NOTE_FILTER_MODE_FLAG_SWITCH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mode.flag &= ~NOTE_FILTER_MODE_FLAG_SWITCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
ioctl(notectlfd, NOTECTL_SETMODE, (unsigned long)&mode);
|
||||||
|
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable)
|
|
||||||
{
|
|
||||||
mode.flag |= NOTE_FILTER_MODE_FLAG_SWITCH;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mode.flag &= ~NOTE_FILTER_MODE_FLAG_SWITCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
ioctl(notectlfd, NOTECTL_SETMODE, (unsigned long)&mode);
|
|
||||||
|
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
@ -735,29 +738,32 @@ static int trace_cmd_print(int index, int argc, FAR char **argv,
|
|||||||
|
|
||||||
/* Parse the setting parameters */
|
/* Parse the setting parameters */
|
||||||
|
|
||||||
if (argv[index][0] == '-' || argv[index][0] == '+')
|
if (index < argc)
|
||||||
{
|
{
|
||||||
enable = (argv[index][0] == '+');
|
if (argv[index][0] == '-' || argv[index][0] == '+')
|
||||||
if (enable ==
|
|
||||||
((mode.flag & NOTE_FILTER_MODE_FLAG_DUMP) != 0))
|
|
||||||
{
|
{
|
||||||
/* Already set */
|
enable = (argv[index][0] == '+');
|
||||||
|
if (enable ==
|
||||||
|
((mode.flag & NOTE_FILTER_MODE_FLAG_DUMP) != 0))
|
||||||
|
{
|
||||||
|
/* Already set */
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
mode.flag |= NOTE_FILTER_MODE_FLAG_DUMP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mode.flag &= ~NOTE_FILTER_MODE_FLAG_DUMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
ioctl(notectlfd, NOTECTL_SETMODE, (unsigned long)&mode);
|
||||||
|
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable)
|
|
||||||
{
|
|
||||||
mode.flag |= NOTE_FILTER_MODE_FLAG_DUMP;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mode.flag &= ~NOTE_FILTER_MODE_FLAG_DUMP;
|
|
||||||
}
|
|
||||||
|
|
||||||
ioctl(notectlfd, NOTECTL_SETMODE, (unsigned long)&mode);
|
|
||||||
|
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user