Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C9E2C64E7A for ; Tue, 1 Dec 2020 14:20:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3D3320757 for ; Tue, 1 Dec 2020 14:20:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3D3320757 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E01289CB9; Tue, 1 Dec 2020 14:20:04 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3468489DD8 for ; Tue, 1 Dec 2020 14:20:02 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id ABE3FAC55; Tue, 1 Dec 2020 14:20:00 +0000 (UTC) Subject: Re: [PATCH v2 26/28] video: fbdev: uvesafb: Fix string related warnings To: Sam Ravnborg , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Lee Jones References: <20201128224114.1033617-1-sam@ravnborg.org> <20201128224114.1033617-27-sam@ravnborg.org> From: Thomas Zimmermann Message-ID: <371d184b-2a7c-6135-4816-635684d8481d@suse.de> Date: Tue, 1 Dec 2020 15:19:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201128224114.1033617-27-sam@ravnborg.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vaibhav Gupta , Tetsuo Handa , Michal Januszewski , Laurent Pinchart , Jiri Slaby , Arnd Bergmann , Florian Tobias Schandinat , Evgeny Novikov , Saeed Mirzamohammadi , Daniel Vetter , Thomas Winischhofer , Bartlomiej Zolnierkiewicz , Jani Nikula , Aditya Pakki , Xiaofei Tan , Nathan Chancellor , Alex Dewar , Jason Yan , Greg Kroah-Hartman , Qilong Zhang , Randy Dunlap , Gustavo Silva , Peter Rosin , George Kennedy , Kristoffer Ericson , Alexander Klimov , Jingoo Han , Joe Perches , Peilin Ye , Mike Rapoport Content-Type: multipart/mixed; boundary="===============1592878461==" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============1592878461== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JfZld2eGqcvHKT9MDWgJ3Txd9h3PcmMoU" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --JfZld2eGqcvHKT9MDWgJ3Txd9h3PcmMoU Content-Type: multipart/mixed; boundary="UBR5qugZwEwYLrXvY9M5OibDwLul69cQx"; protected-headers="v1" From: Thomas Zimmermann To: Sam Ravnborg , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Lee Jones Cc: Aditya Pakki , Alexander Klimov , Alex Dewar , Antonino Daplas , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Benjamin Herrenschmidt , Daniel Vetter , Evgeny Novikov , Florian Tobias Schandinat , George Kennedy , Greg Kroah-Hartman , Gustavo Silva , Jani Nikula , Jason Yan , Jingoo Han , Jiri Slaby , Joe Perches , Kristoffer Ericson , Laurent Pinchart , Mike Rapoport , Nathan Chancellor , Peilin Ye , Peter Rosin , Qilong Zhang , Randy Dunlap , Saeed Mirzamohammadi , Tetsuo Handa , Thomas Winischhofer , Vaibhav Gupta , Xiaofei Tan , Michal Januszewski Message-ID: <371d184b-2a7c-6135-4816-635684d8481d@suse.de> Subject: Re: [PATCH v2 26/28] video: fbdev: uvesafb: Fix string related warnings References: <20201128224114.1033617-1-sam@ravnborg.org> <20201128224114.1033617-27-sam@ravnborg.org> In-Reply-To: <20201128224114.1033617-27-sam@ravnborg.org> --UBR5qugZwEwYLrXvY9M5OibDwLul69cQx Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Am 28.11.20 um 23:41 schrieb Sam Ravnborg: > Two W=3D1 string related warnings. > - Using strncpy to copy string without null-termination generates a > warning. Use memcpy to copy only the relevant chars >=20 > - Fix a potential bug with a very long string, subtract one from the > length to make room for the termination null. >=20 > Signed-off-by: Sam Ravnborg > Cc: Michal Januszewski > Cc: linux-fbdev@vger.kernel.org > --- > drivers/video/fbdev/uvesafb.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesaf= b.c > index 8ee0fc9c63cf..45dc8da191e4 100644 > --- a/drivers/video/fbdev/uvesafb.c > +++ b/drivers/video/fbdev/uvesafb.c > @@ -423,7 +423,7 @@ static int uvesafb_vbe_getinfo(struct uvesafb_ktask= *task, > task->t.flags =3D TF_VBEIB; > task->t.buf_len =3D sizeof(struct vbe_ib); > task->buf =3D &par->vbe_ib; > - strncpy(par->vbe_ib.vbe_signature, "VBE2", 4); > + memcpy(par->vbe_ib.vbe_signature, "VBE2", 4); > =20 > err =3D uvesafb_exec(task); > if (err || (task->t.regs.eax & 0xffff) !=3D 0x004f) { > @@ -1871,7 +1871,7 @@ static ssize_t v86d_show(struct device_driver *de= v, char *buf) > static ssize_t v86d_store(struct device_driver *dev, const char *buf,= > size_t count) > { > - strncpy(v86d_path, buf, PATH_MAX); > + strncpy(v86d_path, buf, PATH_MAX - 1); From lookign a the drive rcode, I assume that the code never touches=20 the final byte in v86d_path. So it remains \0 indefinitely. Acked-by: Thomas Zimmermann > return count; > } > static DRIVER_ATTR_RW(v86d); >=20 --=20 Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany (HRB 36809, AG N=C3=BCrnberg) Gesch=C3=A4ftsf=C3=BChrer: Felix Imend=C3=B6rffer --UBR5qugZwEwYLrXvY9M5OibDwLul69cQx-- --JfZld2eGqcvHKT9MDWgJ3Txd9h3PcmMoU Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEExndm/fpuMUdwYFFolh/E3EQov+AFAl/GUQ0FAwAAAAAACgkQlh/E3EQov+A4 whAAmnx+/ghdkNbUQYtMRgGcEtLA8ikDqj18hnPB20yzGCeEuIHaNDHGkA3gkDz6/NdseY/8mGhe LcJf7e3PGZSRzGhZ5Vwiagdl+44SO5pwj6HFNxU/uq9dnWGHaBi/rbRw+S8acKmWg5lKaWS+oW5H CYwZdRRr7iQPwvk/YJJt93Vda2QArCNcn8EtuR27YJZ50KPhEXbBu8iRdvEEoOiH5cbOPPyBgcR+ j/q7uaWlAZ3Oc9RlkLK2iNPZ53mKQ6bWzUamuA7OG0eL16kRSNW/zs9c54Pwo51BwTQrfhDHnblr ejDz71Fw+m6mRYFF40TMuWSYmTzXgRQYxJOr4BFHomD0Muwy3YyPnMjamjFD9N2Bd+NBHUbhS2Ul z2KvNsfTp+1VFk6rgigdbhUq4zPCIxxWUNGOy3RBTAbQdjoPcWZU/Hhpfk5RSuINWRZ4EINuhD+p y2WJA9P9Zzr4liDcMY38Rnx0i/fCIjtPtF4VCoTq8WENwljVUoRbWj1J5Pl2nWH/E1LuDWYSrDDK SN4RnLPCVuqJFFgUkm0AYsEgOiqb0Sra7qn2fyZ3Aqsxdx8bbXJp7JbKN3e/KCO2YNnepjPGLoRT 4alss5WQ40bh2UH6mf23vcGho6RMmq1iwzLRSxRhHXQ5FMXnU7d+Win722SjMTgaG0GdgmkmB8kB PFY= =umm4 -----END PGP SIGNATURE----- --JfZld2eGqcvHKT9MDWgJ3Txd9h3PcmMoU-- --===============1592878461== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1592878461==--