Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2161728pxb; Tue, 12 Oct 2021 00:07:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYbQPGy9V1bhi77q2Q/Vzyy5ZMZCQxJmt6VQhNqZb36CJei8BRhgi9IIP6icX6v2YAmGDk X-Received: by 2002:a17:90b:33cf:: with SMTP id lk15mr4059943pjb.204.1634022449728; Tue, 12 Oct 2021 00:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634022449; cv=none; d=google.com; s=arc-20160816; b=bQMkIITfCx52xDJMDwlqZ7kOHsvVMuEn/EihmZeP96TGl+hEwK5rZM24qeJ3X+oE7G 8MK8wJa3Fe56UCrXgac9nUEWWTSwi9kFvHehMgjWBhv56YtOIqu5eDRiOemgceZOOxXJ HZUCfNHBJbILarT0v6UbKFZpZoLcoeFNzWLFZlB74W8aPz8wDkUUzedYeQDeyB7Qek72 Uiqv0K8MetMC1UtCyb3UNsGB/wCwHBDUkJVccZj03AghW8T7+/2RUzNXxkm6PXl0CQpC VLUadWbnY/8LG/xUxgJdJA30cdXQhdKmb3em1EPj/FI4sux2PJZg0gajdxlXDxkfCxMO 519w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:content-transfer-encoding :mime-version:in-reply-to:references:subject:cc:to:from:date :message-id; bh=429SlH6gjgOT/El1tmCqVfnegSoaG6LGjAn1EfCqZZM=; b=ouClXVBxuZIPuMr3uZPT72cPivlPiMdE6q9W9G0/n9l7i0eQI3rZXw6bSqxsQ/MZLv kwERZVaPQpo58txyIp6tcMFEltu+MTvWMDQdApm0EdcQT8h0NUlVdaVYaFgCnNM72w2v heCVVLyFVTq2IeFxlCEyK/6aJHh2XtkeJZxTt2uCMbMAGdEYwmTILO7ikD2p3UP8eJ9x 58UtotfHhypB9WXzsnjhjZD7xIgJIE31MrTAEiKpkFuITBTzE4HEsuKqr+7eQSa1nxPN fWRyNbmSRp0kNrGbeWQlPR4Dod1DrKiZSoE9AsJXRVEWKPC0l9fgjiiRLFSUa0fH5rkE TZUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k20si2435050pji.176.2021.10.12.00.07.15; Tue, 12 Oct 2021 00:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233794AbhJLHGi convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 Oct 2021 03:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233712AbhJLHGg (ORCPT ); Tue, 12 Oct 2021 03:06:36 -0400 X-Greylist: delayed 88142 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 12 Oct 2021 00:04:34 PDT Received: from mx3.uni-regensburg.de (mx3.uni-regensburg.de [IPv6:2001:638:a05:137:165:0:4:4e79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 973D8C06161C; Tue, 12 Oct 2021 00:04:34 -0700 (PDT) Received: from mx3.uni-regensburg.de (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 032826000054; Tue, 12 Oct 2021 09:04:30 +0200 (CEST) Received: from gwsmtp.uni-regensburg.de (gwsmtp1.uni-regensburg.de [132.199.5.51]) by mx3.uni-regensburg.de (Postfix) with ESMTP id D8F2F6000050; Tue, 12 Oct 2021 09:04:29 +0200 (CEST) Received: from uni-regensburg-smtp1-MTA by gwsmtp.uni-regensburg.de with Novell_GroupWise; Tue, 12 Oct 2021 09:04:29 +0200 Message-Id: <6165337C020000A1000446A6@gwsmtp.uni-regensburg.de> X-Mailer: Novell GroupWise Internet Agent 18.3.1 Date: Tue, 12 Oct 2021 09:04:28 +0200 From: "Ulrich Windl" To: , , "Chris Leech" , , "Lee Duncan" Cc: "open-iscsi" , , Subject: Re: Antw: [EXT] Re: [PATCH] scsi scsi_transport_iscsi.c: fix misuse of %llu in scsi_transport_iscsi.c References: <20211009030254.205714-1-qtxuning1999@sjtu.edu.cn> <5daf69b365e23ceecee911c4d0f2f66a0b9ec95c.camel@perches.com> <6163DB2E020000A1000445F1@gwsmtp.uni-regensburg.de> In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> Mike Christie schrieb am 11.10.2021 um 17:29 in Nachricht : > On 10/11/21 1:35 AM, Ulrich Windl wrote: >>>>> Joe Perches schrieb am 09.10.2021 um 05:14 in Nachricht >> <5daf69b365e23ceecee911c4d0f2f66a0b9ec95c.camel@perches.com>: >>> On Sat, 2021-10-09 at 11:02 +0800, Guo Zhi wrote: >>>> Pointers should be printed with %p or %px rather than >>>> cast to (unsigned long long) and printed with %llu. >>>> Change %llu to %p to print the pointer into sysfs. >>> ][] >>>> diff --git a/drivers/scsi/scsi_transport_iscsi.c >>> b/drivers/scsi/scsi_transport_iscsi.c >>> [] >>>> @@ -129,8 +129,8 @@ show_transport_handle(struct device *dev, struct >>> device_attribute *attr, >>>> >>>> >>>> if (!capable(CAP_SYS_ADMIN)) >>>> return -EACCES; >>>> - return sysfs_emit(buf, "%llu\n", >>>> - (unsigned long long)iscsi_handle(priv->iscsi_transport)); >>>> + return sysfs_emit(buf, "%p\n", >>>> + iscsi_ptr(priv->iscsi_transport)); >>> >>> iscsi_transport is a pointer isn't it? >>> >>> so why not just >>> >>> return sysfs_emit(buf, "%p\n", priv->iscsi_transport); >> >> Isn't the difference that %p outputs hex, while %u outputs decimal? >> > > Yeah, I think this patch will break userspace, because it doesn't know it's > a pointer. It could be doing: > > sscanf(str, "%llu", &val); > > The value is just later passed back to the kernel to look up a driver in > iscsi_if_transport_lookup: > > list_for_each_entry(priv, &iscsi_transports, list) { > if (tt == priv->iscsi_transport) { > > so we could just replace priv->transport with an int and use an ida to assign > the value. I'm not in the details, but if that value is used as an ID, shouldn't it have been something like "ID%llu" right from the start? If so it would be rather easy to use "ID%p" instead (if the syntax of the ID is left unspecified). At least nobody would treat it as a number. Regards, Ulrich > > -- > You received this message because you are subscribed to the Google Groups > "open-iscsi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to open-iscsi+unsubscribe@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/open-iscsi/ae7a82c2-5b19-493a-8d61-cdccb00c > f46c%40oracle.com.