From 6d28a80ff36c3d3487bdfe9cb00d2dd99602ac12 Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Tue, 7 Oct 2014 20:42:02 +0300 Subject: Size of pointer 'P' used instead of size of its data. CppCheck marks this as a warning that P might be used in sizeof instead of P->tty_text so we'll use sizeof (P->tty_text) to make it explicit. --- src/ck-sysdeps-freebsd.c | 8 ++++---- src/ck-sysdeps-openbsd.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ck-sysdeps-freebsd.c b/src/ck-sysdeps-freebsd.c index 3304c94..1d6d5b4 100644 --- a/src/ck-sysdeps-freebsd.c +++ b/src/ck-sysdeps-freebsd.c @@ -184,11 +184,11 @@ stat2proc (pid_t pid, snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min); if (p.kp_tdev != NODEV && (ttname = devname (p.kp_tdev, S_IFCHR)) != NULL) { - memcpy (P->tty_text, ttname, sizeof P->tty_text); + memcpy (P->tty_text, ttname, sizeof (P->tty_text)); } if (p.kp_tdev == NODEV) { - memcpy (P->tty_text, " ? ", sizeof P->tty_text); + memcpy (P->tty_text, " ? ", sizeof (P->tty_text)); } if (P->pid != pid) { @@ -244,11 +244,11 @@ stat2proc (pid_t pid, snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min); if (p.ki_tdev != NODEV && (ttname = devname (p.ki_tdev, S_IFCHR)) != NULL) { - memcpy (P->tty_text, ttname, sizeof P->tty_text); + memcpy (P->tty_text, ttname, sizeof (P->tty_text)); } if (p.ki_tdev == NODEV) { - memcpy (P->tty_text, " ? ", sizeof P->tty_text); + memcpy (P->tty_text, " ? ", sizeof (P->tty_text)); } if (P->pid != pid) { diff --git a/src/ck-sysdeps-openbsd.c b/src/ck-sysdeps-openbsd.c index e87698a..29bb4ba 100644 --- a/src/ck-sysdeps-openbsd.c +++ b/src/ck-sysdeps-openbsd.c @@ -191,15 +191,15 @@ stat2proc (pid_t pid, snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min); if (p.p_tdev != NODEV && (ttname = devname (p.p_tdev, S_IFCHR)) != NULL) { - memcpy (P->tty_text, ttname, sizeof P->tty_text); + memcpy (P->tty_text, ttname, sizeof (P->tty_text)); } if (p.p_tdev == NODEV) { /* XXX how do we associate X with its tty? */ #if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) - memcpy (P->tty_text, "/dev/ttyC4", sizeof P->tty_text); + memcpy (P->tty_text, "/dev/ttyC4", sizeof (P->tty_text)); #else - memcpy (P->tty_text, "/dev/ttyC0", sizeof P->tty_text); + memcpy (P->tty_text, "/dev/ttyC0", sizeof (P->tty_text)); #endif } -- cgit v1.2.3