Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3151351pxv; Sun, 18 Jul 2021 12:45:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlln5CC9Q0MhYhFma4APh+Hjw1dcv3OwyoHeF/jFpjiJjSYK3OR3FXFlAvvR/bFPrl6YWc X-Received: by 2002:a05:6638:1915:: with SMTP id p21mr18138143jal.104.1626637532785; Sun, 18 Jul 2021 12:45:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626637532; cv=none; d=google.com; s=arc-20160816; b=gfhXFFIhKqfuDGJD6BQg+UHdaumi4BDG+lo7J1CqiN9j6CGIZi0oJdjDLXyMaK+O1h 2JpUEX90FNt5OZ04QXh0B1SkYI9C1nCD9y7Ov4/+NZvE6kpBjB9mwDEn0UFUWNg/ewFk 9GyK4V7J3tMxEsb//liVaUlX603gPl6EEK0om4Od132al1gucqu+wk5seKQtaBR8haT1 CinQZLo4StADJi8btTHanRmE2aiQVm8/emK/JpkvEj969WB+A4cgzXD8k3OTblZyIIG2 3B2qF3ugL7JGylSdmdmhYgFslAsTscCayJb3CCZgjUGWeQ7rQfdd7ESx+AS/kpowNSz1 4MHg== 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=7exFBskhTjXcI0G1jQYaweC6zi6nB0YxhW9GhW8QVJk=; b=isBenjZjHJ01uOkAiTJA8xHBh0/PijrturLRyUCwYWQKMforhemodXtsCMAMD6GgcZ D4Gr7XS9kw4zKhx9Al6pUI66eRnzQ1Phws630VGxoNr5im77NhEo1rqo49kayxJHK5az Gc8FftZkXFJ21JQoc5G/8JMZSn6c3IST3ooDsQXV7T0iggB7VGcQVUoyFpBy+e0BsU09 lNmWzAXzaFACDehLlOq5wOHJXRMIBgzoZFDVvTeWB+AzCTt+zPkszawg1xbRBwCVG9uq OvPw/u4FqoQrEwLP/PwvyVtJUuj93d4EDdBGBNHDcLNqWnKcasfcDf9fz71FWCQeEw0G f5Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hTAqgsHv; 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 v10si491484ilh.117.2021.07.18.12.45.19; Sun, 18 Jul 2021 12:45:32 -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=hTAqgsHv; 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 S230128AbhGRTqS (ORCPT + 99 others); Sun, 18 Jul 2021 15:46:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbhGRTqR (ORCPT ); Sun, 18 Jul 2021 15:46:17 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 292E0C061762; Sun, 18 Jul 2021 12:43:19 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id bt15so10058638pjb.2; Sun, 18 Jul 2021 12:43:19 -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=7exFBskhTjXcI0G1jQYaweC6zi6nB0YxhW9GhW8QVJk=; b=hTAqgsHvvgfNcEagZtVOoEg9FPZ1K7swFoeQE74LVxhVPjWe4cMJ36z1icfI5N90l0 Q5NEeHaePN4cZlD/CHtW4Q3HajTJXac5NUjQ3Tfn2qYdk7cJOxD93QiuahCUEOdvoYan yWAQXjAMKElZboyb3fVwi3x1JZL/sJ6Kaf4cbOmJ4HWzjIM7H5CRcv+C/ovoiTK5KLZO MewH468+Xkk/Jq2ehDT+j7bKEfHjqYerJXYXfL+fUWicAa9dKBPN3mXL6A41iuyJcvu0 q699wJgigkj4sMp84K14HXfLRz4drOEqjzlqLQhWSBDA6e5vjBNH9oe/EgXH+w0RCd+7 LXXQ== 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=7exFBskhTjXcI0G1jQYaweC6zi6nB0YxhW9GhW8QVJk=; b=hzXQQjqBS0Dn4fcomJyCxdw5jlUTqkBv7NNsLWVST38focPuLioFLiv39VW7D2xDT3 U86rtZtpcNuNJwPPRchhD54vpO5K89FUpr4Wnr/NtUdis/SQVXveaHnv7ITBxSWY1Ix4 LeILry6BiLyVOILgsQLL5bT+imfUV8iUPQPx4zj10Ab0jV+IZlp95rofNGF9e69R0CEA Ttp6BlOg3mC/ZuARw/n59Ip8yFJVjcC7J7Xt2kPLmY7RD1aG0RzxBTsiFF84/RsWAHnW b73xbCQwwHC0ZHzs5at4lTbo0zNbjZcobfKJ4jgI20Qbp2izi1CD86lCncL9qLqxuHff X1sg== X-Gm-Message-State: AOAM531FSTCXOaSqt7UbuJwxC+lz1d/Wl3G0M/SieLiC6nZErNQ+dHl8 ISGzI7P6PZ1uL2KdfmZ8yJxtzuyLyOrje/xm6aw= X-Received: by 2002:a17:902:b198:b029:11b:2246:e374 with SMTP id s24-20020a170902b198b029011b2246e374mr16552094plr.17.1626637398478; Sun, 18 Jul 2021 12:43:18 -0700 (PDT) MIME-Version: 1.0 References: <20210718133920.15825-1-len.baker@gmx.com> In-Reply-To: <20210718133920.15825-1-len.baker@gmx.com> From: Andy Shevchenko Date: Sun, 18 Jul 2021 22:42:42 +0300 Message-ID: Subject: Re: [PATCH] staging/fbtft: Remove all strcpy() uses To: Len Baker Cc: Greg Kroah-Hartman , Andy Shevchenko , Phil Reid , 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 18, 2021 at 4:43 PM Len Baker wrote: > > strcpy() performs no bounds checking on the destination buffer. This > could result in linear overflows beyond the end of the buffer, leading > to all kinds of misbehaviors. The safe replacement is strscpy() but in > this case it is simpler to add NULL to the first position since we want > to empty the string. > This is a previous step in the path to remove the strcpy() function. Any document behind this (something to read on the site(s) more or less affiliated with what is going to happen in the kernel) to read background? ... > case -1: > i++; > /* make debug message */ > - strcpy(msg, ""); > + msg[0] = 0; Strictly speaking it should be '\0'. > j = i + 1; > while (par->init_sequence[j] >= 0) { > sprintf(str, "0x%02X ", par->init_sequence[j]); -- With Best Regards, Andy Shevchenko