Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751308AbcL1JrU (ORCPT ); Wed, 28 Dec 2016 04:47:20 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35665 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231AbcL1JrS (ORCPT ); Wed, 28 Dec 2016 04:47:18 -0500 Subject: Re: [PATCH 1/1] [media] v4l: rcar_fdp1: use %4.4s to format a 4-byte string To: Nicolas Iooss , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org References: <20161226133139.3775-1-nicolas.iooss_linux@m4x.org> Cc: linux-kernel@vger.kernel.org From: Kieran Bingham Message-ID: <63afb58e-e588-c3f0-7950-2e2b5dfa453e@bingham.xyz> Date: Wed, 28 Dec 2016 09:47:15 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161226133139.3775-1-nicolas.iooss_linux@m4x.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1967 Lines: 51 Hi Nicolas, Thankyou for the patch This looks like a good catch, On 26/12/16 13:31, Nicolas Iooss wrote: > Using %4s to format f->fmt.pix_mp.pixelformat in fdp1_try_fmt() and > fdp1_s_fmt() may lead to more characters being printed (when the byte > following field pixelformat is not zero). > > Add ".4" to the format specifier to limit the number of printed > characters to four. The resulting format specifier "%4.4s" is also used > by other media drivers to print pixelformat value. > > Signed-off-by: Nicolas Iooss Reviewed-by: Kieran Bingham > --- > drivers/media/platform/rcar_fdp1.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c > index 674cc1309b43..42f25d241edd 100644 > --- a/drivers/media/platform/rcar_fdp1.c > +++ b/drivers/media/platform/rcar_fdp1.c > @@ -1596,7 +1596,7 @@ static int fdp1_try_fmt(struct file *file, void *priv, struct v4l2_format *f) > else > fdp1_try_fmt_capture(ctx, NULL, &f->fmt.pix_mp); > > - dprintk(ctx->fdp1, "Try %s format: %4s (0x%08x) %ux%u field %u\n", > + dprintk(ctx->fdp1, "Try %s format: %4.4s (0x%08x) %ux%u field %u\n", > V4L2_TYPE_IS_OUTPUT(f->type) ? "output" : "capture", > (char *)&f->fmt.pix_mp.pixelformat, f->fmt.pix_mp.pixelformat, > f->fmt.pix_mp.width, f->fmt.pix_mp.height, f->fmt.pix_mp.field); > @@ -1671,7 +1671,7 @@ static int fdp1_s_fmt(struct file *file, void *priv, struct v4l2_format *f) > > fdp1_set_format(ctx, &f->fmt.pix_mp, f->type); > > - dprintk(ctx->fdp1, "Set %s format: %4s (0x%08x) %ux%u field %u\n", > + dprintk(ctx->fdp1, "Set %s format: %4.4s (0x%08x) %ux%u field %u\n", > V4L2_TYPE_IS_OUTPUT(f->type) ? "output" : "capture", > (char *)&f->fmt.pix_mp.pixelformat, f->fmt.pix_mp.pixelformat, > f->fmt.pix_mp.width, f->fmt.pix_mp.height, f->fmt.pix_mp.field); > -- Regards Kieran Bingham