Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp2973467pxv; Sun, 25 Jul 2021 11:56:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybgV4bv6looGWdQkFo5dGFeLZpUpCNcpMW7qytdtwzJlvjukz2KzIOkt2ZlCabekJ16JBm X-Received: by 2002:aa7:cd49:: with SMTP id v9mr14725308edw.185.1627239370448; Sun, 25 Jul 2021 11:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627239370; cv=none; d=google.com; s=arc-20160816; b=YRAYnDEyD3fMftOQWPWY/ETkbM36WZvtqoi8xwSZR2ttbWE8ZCPNp2Iby0XB33R3hp Sc7YIrL8seov0dCrbm370iduWXaTV6+jxCAuOm4XCUiXRlTxtU7gHY2u2Peb/cKnAOZl FZje9HBp8dph+oiUNzR8BZvK+xIaLi4s0H6Sb8vnq15RMk0snhlm33ycjFOWIuJZH8mN ozyjJgK903bx0EoQpAET/bv/IUjTj3GL29qLUjvQIJOrUEasHlx82XoUkxNYOhj8qHU0 GUrZ94jhFs6uWnib2SagTjt8HBSyNHnU183nUbOCOzVroOkB3gdOvG3gu8Q4RMTqoSlj 0qJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Qirs+iLZFGRKsz/ZopqRyNng3+a0VdaNoIeySOmoJBs=; b=oYCYy8R+Xq4qsJiS0Pgezgjm/JnJePE52CoA6EjSK9EEQJJm9H7KNqunysEOtDYD41 KIFwS8E+SPmzvnloxj7B2MvS8gVWdXGX5E5MAlS6ZwaObgmzxFgrZUnPsR14hC9qjkxD OYEaw6k3utKAJF3gZZeh6RXCVqkkD9mjBhsCHbMtKFTVfZg8oR1PTDO/z4hieAhpykEM csqFI/QfuIOETpbrd3V6fXCX8CdVSb18tMwnUi7lDcl50kQffFCSGReIsCJ/8Vq3pcM3 A2jVMWnj8w2XjQZatiCbgYRbg2MvZT3OZ9yXiaVXGkQK8F4If1ZT8EFKxorgNlVrw7Yq nhwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ryQJ486S; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si7322277edm.532.2021.07.25.11.55.47; Sun, 25 Jul 2021 11:56:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ryQJ486S; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231321AbhGYSL0 (ORCPT + 99 others); Sun, 25 Jul 2021 14:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230244AbhGYSLZ (ORCPT ); Sun, 25 Jul 2021 14:11:25 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FE4BC061757; Sun, 25 Jul 2021 11:51:54 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id k1so8907723plt.12; Sun, 25 Jul 2021 11:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Qirs+iLZFGRKsz/ZopqRyNng3+a0VdaNoIeySOmoJBs=; b=ryQJ486SrysdfwQYYY2pSFz6x9WPYf3me6zDgsy0m4p2aDx7AsvFubmhNxrWI+j4mv nsvVtOQpACYSIKSnrUTMMMUUQdp3SgVsYl0TD7ExOXYMOl9F27ZE/bAU4iYLTFdlttbM mgCsWVFzt5OIJaGyyWvVlaXnqOtUUQ3nC2OVhZV1MZ77YP7msKpmtmRPj9vV2BXO76Wu DeRSI5ITm7mYKMjdHyrm4wxysMYOQwP9EkFdubOY8tc52aVAyjbKLgzmaoChdQBcBiij VHm02K4+SLwTlRDCumkBT32LVccoGk37flJDSBLtEmBt5OrWlE4gDEz5t7dxqImxSUYj ZVyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Qirs+iLZFGRKsz/ZopqRyNng3+a0VdaNoIeySOmoJBs=; b=n4D0gmo2T5CESr+dmd2SLKtoxl6Cpccc6vYcxLJ6kUmq35t2RuKqpWYap3H9bzvnU6 71sz6xzkobxNR5bXrbQKfeNKSDW2mnr4T4fWt8G4OgLRGtNvZbxeTP5KwE7soywXgH0b HCpXUWwO8mj0ZlYQ9UGm2kRruWG2xHC61fCxmeVPcne+RfHc6t0pYkf1JgnlHKVb7sI4 0d6WVyoLKv96MqAZobh5KvrY38RU8yuFd0E+huyJoeH0JRLOUg1Txypd+tmVS+YgVJxC SQumXurNNeGjCNUVBcBvM/6OBFTcCy9BkcKnW7iVuieWN90df9POy89MjlfIb8AeOKsK gZNg== X-Gm-Message-State: AOAM531vQWAqE9h2ICb46ZBFSnXEbNFN2FZ20h0mux08GDSAsyqX5MEN FmhoJp2fMOQMtSFrj5u/6LflxZhZ8slz5De+1jY= X-Received: by 2002:a63:d014:: with SMTP id z20mr14700708pgf.203.1627239114212; Sun, 25 Jul 2021 11:51:54 -0700 (PDT) MIME-Version: 1.0 References: <20210724151411.9531-1-len.baker@gmx.com> <20210724151411.9531-2-len.baker@gmx.com> <20210725135844.GA1953@titan> In-Reply-To: <20210725135844.GA1953@titan> From: Andy Shevchenko Date: Sun, 25 Jul 2021 21:51:18 +0300 Message-ID: Subject: Re: [PATCH v2 1/3] staging/fbtft: Remove all strcpy() uses To: Len Baker Cc: Greg Kroah-Hartman , Phil Reid , Geert Uytterhoeven , dri-devel , "open list:FRAMEBUFFER LAYER" , linux-staging@lists.linux.dev, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 25, 2021 at 4:59 PM Len Baker wrote: > On Sat, Jul 24, 2021 at 11:21:04PM +0300, Andy Shevchenko wrote: > > On Sat, Jul 24, 2021 at 7:05 PM Len Baker wrote: ... > > > - char msg[128]; > > > > 128 / 4 = 32. So, this buffer is enough to debug print only up to 32 > > bytes. Hence %*ph replacement won't cut output earlier than requested. > > I'm sorry, but I don't understand what you are trying to explain. Moreover, > with the "0x%02X " in the sprintf followed by the strcat, the msg buffer can > print 128/5 values (25 hex values). > > The %*ph replacement can print up to 64 bytes, so I don't see any problem > here. Right. That's what I am trying to say and the hint here is to combine this part into a phrase in the commit message in the next version of the patch. ... > > > + for (j = i + 1; par->init_sequence[j] >= 0; j++); > > > > Why is i + 1 initial for the j? You may rather access the 'i + 1 + > > j'th element in the array... > > > > ... > > > > > + par->init_sequence[i], j - i - 1, > > > > ...and get rid of the ' - i -1' part here. > > Yes, it was the first idea but I prefer this method since we save aritmethic > operations. In other words, if I use what you suggest, the index for > par->init_sequence is calculated as a "sum" every iteration. But if the > performance is not an issue and you believe that the above is more clear, I > have no problem. What do you prefer? I prefer my variant and I believe the compilers nowadays are clever enough to understand this. Have you tried to compile and compare the real assembly? -- With Best Regards, Andy Shevchenko