From patchwork Tue Dec 8 14:25:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 7798061 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BCDE99F387 for ; Tue, 8 Dec 2015 14:26:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8FD0204DE for ; Tue, 8 Dec 2015 14:26:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD5DF203DB for ; Tue, 8 Dec 2015 14:26:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932912AbbLHOZx (ORCPT ); Tue, 8 Dec 2015 09:25:53 -0500 Received: from mail-lf0-f54.google.com ([209.85.215.54]:33573 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756279AbbLHOZw (ORCPT ); Tue, 8 Dec 2015 09:25:52 -0500 Received: by lfaz4 with SMTP id z4so13699710lfa.0 for ; Tue, 08 Dec 2015 06:25:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id; bh=fuHnjfutzxF88X9uNA3Ny/UREJSEJA6fypwmcfBn164=; b=A/eY7fpsXAUvZn1PCbPMBz1o21Z+0jo7VOF5g0+agO1QeYB8oPPXjkdE6R+4ADFTuw BVAmHipwk4G2leZ2AWUXSNq2fPs7KbBztAGUPlciwwyO4lyAkqFa9WwWywzIrPdVtQE/ gKBjgsr+bz7yE+Br1uyh0bhmJa7+3qaT3dhpE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fuHnjfutzxF88X9uNA3Ny/UREJSEJA6fypwmcfBn164=; b=kUXSEYbw9FsWDj13yRo5bM4fSHpPFBxwpr+oouGBWm5OCD6ClpZZW1Tp+mP+ud1u/c ayUrOKjCjT8iWW/+NFIwkb0CYg/PPdTQyAo6f5eQQPPeoIZSG/IvQMzubi4++tb8xY6o B8YxcUjZUEFEi7dmk7e9PEclkDvg2QfYynesRbmM/6gCxgk5SzE0VuG0E3JjCpbMcO8m j12Spo4GicT6PtlJEPRpeZAyyE2/kp8T+F8Z/wgVqoz/gPP8A9SKarZnl7QRscXYevRT yddLouTrVpbMNTjm1brUcylGDshVLvDfudGm4w3mB1N9VQouih/H0w8Xrx735vtGqYIL tBEA== X-Gm-Message-State: ALoCoQnCF7KVFKvrwDTLuG71Wvy7IC5GUGK2+f0RK2tspnXzwvvFfFFd8iCoMt8I0Qii1ZeEG6xou+nuSkcRrbWKZjc/9W/cnQ== X-Received: by 10.25.135.133 with SMTP id j127mr1381409lfd.73.1449584750603; Tue, 08 Dec 2015 06:25:50 -0800 (PST) Received: from garcia.imf.au.dk ([130.225.20.51]) by smtp.gmail.com with ESMTPSA id tv8sm632963lbb.27.2015.12.08.06.25.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 06:25:50 -0800 (PST) From: Rasmus Villemoes To: Boaz Harrosh , Benny Halevy , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Rasmus Villemoes , osd-dev@open-osd.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [SCSI] osd: fix signed char versus %02x issue Date: Tue, 8 Dec 2015 15:25:16 +0100 Message-Id: <1449584716-21093-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.6.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If char is signed and one of these bytes happen to have a value outside the ascii range, the corresponding output will consist of "ffffff" followed by the two hex chars that were actually intended. One way to fix it would be to change the casts to (u8*) aka (unsigned char*), but it is much simpler (and generates smaller code) to use the %ph extension which was created for such short hexdumps. Signed-off-by: Rasmus Villemoes --- drivers/scsi/osd/osd_initiator.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index 0cccd6033feb..d8a2b5185f56 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c @@ -170,10 +170,7 @@ static int _osd_get_print_system_info(struct osd_dev *od, /* FIXME: Where are the time utilities */ pFirst = get_attrs[a++].val_ptr; - OSD_INFO("CLOCK [0x%02x%02x%02x%02x%02x%02x]\n", - ((char *)pFirst)[0], ((char *)pFirst)[1], - ((char *)pFirst)[2], ((char *)pFirst)[3], - ((char *)pFirst)[4], ((char *)pFirst)[5]); + OSD_INFO("CLOCK [0x%6phN]\n", pFirst); if (a < nelem) { /* IBM-OSD-SIM bug, Might not have it */ unsigned len = get_attrs[a].len;