Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752539AbbEDUFz (ORCPT ); Mon, 4 May 2015 16:05:55 -0400 Received: from mail-ig0-f175.google.com ([209.85.213.175]:36625 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752479AbbEDUFv (ORCPT ); Mon, 4 May 2015 16:05:51 -0400 MIME-Version: 1.0 In-Reply-To: <20150504082250.GJ14154@mwanda> References: <1428628204-25752-1-git-send-email-mitchelh@codeaurora.org> <1428628204-25752-2-git-send-email-mitchelh@codeaurora.org> <20150504082250.GJ14154@mwanda> Date: Mon, 4 May 2015 13:05:50 -0700 X-Google-Sender-Auth: Sj3ggpiyFiCKaUfLcXydz_wUz_E Message-ID: Subject: Re: [PATCH v2 2/2] staging: ion: chunk_heap: use %pad for printing dma_addr_t's From: Colin Cross To: Dan Carpenter Cc: Mitchel Humpherys , devel@linuxdriverproject.org, Greg Kroah-Hartman , Android Kernel Team , John Stultz , lkml Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3419 Lines: 75 On Mon, May 4, 2015 at 1:22 AM, Dan Carpenter wrote: > On Thu, Apr 09, 2015 at 06:10:04PM -0700, Mitchel Humpherys wrote: >> We're currently using %lu and %ld to print some variables of type >> dma_addr_t, which results in the following warning when dma_addr_t is >> 64-bits wide: >> >> drivers/staging/android/ion/ion_chunk_heap.c: In function 'ion_chunk_heap_create': >> drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'dma_addr_t' [-Wformat=] >> pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base, >> ^ >> drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'dma_addr_t' [-Wformat=] >> >> Fix this by using %pad as instructed in printk-formats.txt. >> >> Signed-off-by: Mitchel Humpherys > > This one was just merged and I was about to email you that it introduces > some new Smatch warnings, but actually looking at it, it's just wrong. > > We want to print "chunk_heap->base" and not "&chunk_heap->base". This would be correct if base was a dma_addr_t... > And anyway "&chunk_heap->base" is a regular pointer, not a dma_addr_t. But it is actually an ion_phys_addr_t, which is currently typedef'd to unsigned long. Are you using a local patch that replaces ion_phys_addr_t with dma_addr_t? > So please send a new patch that removes the &. Removing the & is not correct, lib/vsprintf.c will dereference the arg for %pad or %pap. I think this patch should just be dropped, the old %lu was correct for what is in Linus' tree. > regards, > dan carpenter > >> --- >> drivers/staging/android/ion/ion_chunk_heap.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c >> index 54746157d799..6b3e18aa1c64 100644 >> --- a/drivers/staging/android/ion/ion_chunk_heap.c >> +++ b/drivers/staging/android/ion/ion_chunk_heap.c >> @@ -173,8 +173,8 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data) >> chunk_heap->heap.ops = &chunk_heap_ops; >> chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK; >> chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE; >> - pr_debug("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base, >> - heap_data->size, heap_data->align); >> + pr_debug("%s: base %pad size %zu align %pad\n", __func__, >> + &chunk_heap->base, heap_data->size, &heap_data->align); >> >> return &chunk_heap->heap; >> >> -- >> Qualcomm Innovation Center, Inc. >> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, >> a Linux Foundation Collaborative Project >> >> _______________________________________________ >> devel mailing list >> devel@linuxdriverproject.org >> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel > > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. + -- 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/