Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751343AbbLHWVS (ORCPT ); Tue, 8 Dec 2015 17:21:18 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:33491 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbbLHWVQ (ORCPT ); Tue, 8 Dec 2015 17:21:16 -0500 Message-ID: <566757D8.4060400@electrozaur.com> Date: Wed, 09 Dec 2015 00:21:12 +0200 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Rasmus Villemoes , "James E.J. Bottomley" , "Martin K. Petersen" CC: osd-dev@open-osd.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [SCSI] osd: fix signed char versus %02x issue References: <1449584716-21093-1-git-send-email-linux@rasmusvillemoes.dk> In-Reply-To: <1449584716-21093-1-git-send-email-linux@rasmusvillemoes.dk> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1710 Lines: 41 On 12/08/2015 04:25 PM, Rasmus Villemoes wrote: > 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. > Ha real cool, thanks I hated that crap ACK-by: Boaz Harrosh > 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; > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/