Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm Print the cl...



details:   https://anonhg.NetBSD.org/src/rev/c82b2478a124
branches:  trunk
changeset: 790464:c82b2478a124
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Oct 13 07:46:26 2013 +0000

description:
Print the client_id (lwp address) as hex and avoid stack overflow. Use
snprintf while here.

Fixes PR/48287

diffstat:

 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c  |  10 +++++-----
 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c |   2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r fe649faf6714 -r c82b2478a124 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c       Sun Oct 13 06:55:34 2013 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c       Sun Oct 13 07:46:26 2013 +0000
@@ -577,7 +577,7 @@
                        if (status != VCHIQ_SUCCESS) {
                                vchiq_log_error(vchiq_susp_log_level,
                                        "%s: cmd %s returned error %d for "
-                                       "service %c%c%c%c:%03d",
+                                       "service %c%c%c%c:%8x",
                                        __func__,
                                        (cmd == VCHIQ_IOC_USE_SERVICE) ?
                                                "VCHIQ_IOC_USE_SERVICE" :
@@ -1942,7 +1942,7 @@
                VCHIQ_SERVICE_T *service_ptr = state->services[i];
                if (service_ptr && service_ptr->service_use_count &&
                        (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE)) {
-                       snprintf(service_err, 50, " %c%c%c%c(%d) service has "
+                       snprintf(service_err, 50, " %c%c%c%c(%8x) service has "
                                "use count %d%s", VCHIQ_FOURCC_AS_4CHARS(
                                        service_ptr->base.fourcc),
                                 service_ptr->client_id,
@@ -2237,7 +2237,7 @@
                sprintf(entity, "VCHIQ:   ");
                entity_uc = &arm_state->peer_use_count;
        } else if (service) {
-               sprintf(entity, "%c%c%c%c:%03d",
+               snprintf(entity, sizeof(entity), "%c%c%c%c:%8x",
                        VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc),
                        service->client_id);
                entity_uc = &service->service_use_count;
@@ -2366,7 +2366,7 @@
        vchiq_log_trace(vchiq_susp_log_level, "%s", __func__);
 
        if (service) {
-               sprintf(entity, "%c%c%c%c:%03d",
+               snprintf(entity, sizeof(entity), "%c%c%c%c:%8x",
                        VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc),
                        service->client_id);
                entity_uc = &service->service_use_count;
@@ -2596,7 +2596,7 @@
 
        if (ret == VCHIQ_ERROR) {
                vchiq_log_error(vchiq_susp_log_level,
-                       "%s ERROR - %c%c%c%c:%d service count %d, "
+                       "%s ERROR - %c%c%c%c:%8x service count %d, "
                        "state count %d, videocore suspend state %s", __func__,
                        VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc),
                        service->client_id, service->service_use_count,
diff -r fe649faf6714 -r c82b2478a124 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c      Sun Oct 13 06:55:34 2013 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c      Sun Oct 13 07:46:26 2013 +0000
@@ -3664,7 +3664,7 @@
                        if (service->public_fourcc != VCHIQ_FOURCC_INVALID)
                                snprintf(remoteport + len2,
                                        sizeof(remoteport) - len2,
-                                       " (client %x)", service->client_id);
+                                       " (client %8x)", service->client_id);
                } else
                        strcpy(remoteport, "n/a");
 



Home | Main Index | Thread Index | Old Index