pmap: ensure arg1 is not null, and set qualifers to match with usage [smatch scan]
pmap.c:436 main(59) error: we previously assumed 'arg1' could be null (see line 427) pmap.c:136:3: warning: return discards 'const' qualifier from pointer target type [enabled by default] pmap.c:142:4: warning: return discards 'const' qualifier from pointer target type [enabled by default] pmap.c:150:2: warning: return discards 'const' qualifier from pointer target type [enabled by default] pmap.c:300:8: warning: assignment discards 'const' qualifier from pointer target type [enabled by default] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
b2ebca4a60
commit
cbb9e54587
8
pmap.c
8
pmap.c
@ -116,12 +116,12 @@ static void discover_shm_minor(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *mapping_name(proc_t * p, unsigned KLONG addr,
|
static char *mapping_name(proc_t * p, unsigned KLONG addr,
|
||||||
unsigned KLONG len, const char *mapbuf,
|
unsigned KLONG len, const char *mapbuf,
|
||||||
unsigned showpath, unsigned dev_major,
|
unsigned showpath, unsigned dev_major,
|
||||||
unsigned dev_minor, unsigned long long inode)
|
unsigned dev_minor, unsigned long long inode)
|
||||||
{
|
{
|
||||||
const char *cp;
|
char *cp;
|
||||||
|
|
||||||
if (!dev_major && dev_minor == shm_minor && strstr(mapbuf, "/SYSV")) {
|
if (!dev_major && dev_minor == shm_minor && strstr(mapbuf, "/SYSV")) {
|
||||||
static char shmbuf[64];
|
static char shmbuf[64];
|
||||||
@ -433,11 +433,11 @@ int main(int argc, char **argv)
|
|||||||
if(arg2) ++arg2;
|
if(arg2) ++arg2;
|
||||||
else arg2 = arg1;
|
else arg2 = arg1;
|
||||||
|
|
||||||
if (*arg1)
|
if (arg1 && *arg1)
|
||||||
range_low = STRTOUKL(arg1, &arg1, 16);
|
range_low = STRTOUKL(arg1, &arg1, 16);
|
||||||
if (*arg2)
|
if (*arg2)
|
||||||
range_high = STRTOUKL(arg2, &arg2, 16);
|
range_high = STRTOUKL(arg2, &arg2, 16);
|
||||||
if (*arg1 || *arg2)
|
if (arg1 && (*arg1 || *arg2))
|
||||||
usage(stderr);
|
usage(stderr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user