From mboxrd@z Thu Jan 1 00:00:00 1970 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=-11.7 required=3.0 tests=BAYES_00,DATE_IN_PAST_03_06, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SIGNED_OFF_BY,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 89CC2C43461 for ; Tue, 8 Sep 2020 19:52:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A26B2166E for ; Tue, 8 Sep 2020 19:52:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732409AbgIHTwF (ORCPT ); Tue, 8 Sep 2020 15:52:05 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:8215 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730736AbgIHPth (ORCPT ); Tue, 8 Sep 2020 11:49:37 -0400 X-IronPort-AV: E=Sophos;i="5.76,359,1592863200"; d="scan'208";a="466596022" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 14:08:43 +0200 Date: Tue, 8 Sep 2020 14:08:43 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Bartlomiej Zolnierkiewicz cc: kernel test robot , Denis Efremov , kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Daniel Vetter , Nathan Chancellor , Sam Ravnborg , Alex Deucher , Qiujun Huang , Peter Rosin , dri-devel@lists.freedesktop.org Subject: Re: [kbuild-all] Re: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings In-Reply-To: <3c266a0e-a2b9-ffde-0768-3b4fa89b0bfe@samsung.com> Message-ID: References: <202008101736.EtK0s7BQ%lkp@intel.com> <20200810092100.GA42813@2f5448a72a42> <3c266a0e-a2b9-ffde-0768-3b4fa89b0bfe@samsung.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Sep 2020, Bartlomiej Zolnierkiewicz wrote: > > Hi, > > On 8/10/20 11:21 AM, kernel test robot wrote: > > From: kernel test robot > > > > drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf > > drivers/video/fbdev/core/fbcon.c:3484:8-16: WARNING: use scnprintf or sprintf > > > > > > From Documentation/filesystems/sysfs.txt: > > show() must not use snprintf() when formatting the value to be > > returned to user space. If you can guarantee that an overflow > > will never happen you can use sprintf() otherwise you must use > > scnprintf(). > > > > Generated by: scripts/coccinelle/api/device_attr_show.cocci > > > > Fixes: abfc19ff202d ("coccinelle: api: add device_attr_show script") > > CC: Denis Efremov > > Signed-off-by: kernel test robot > > --- > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > head: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7 > > commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script > > > > Please take the patch only if it's a positive warning. Thanks! > > > > fbcon.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > --- a/drivers/video/fbdev/core/fbcon.c > > +++ b/drivers/video/fbdev/core/fbcon.c > > @@ -3481,7 +3481,7 @@ static ssize_t show_rotate(struct device > > rotate = fbcon_get_rotate(info); > > err: > > console_unlock(); > > - return snprintf(buf, PAGE_SIZE, "%d\n", rotate); > > + return scnprintf(buf, PAGE_SIZE, "%d\n", rotate); > > buf length is at least PAGE_SIZE and rotate val is an int so > shouldn't this be converted to use sprintf() instead? The rule is evolving in this direction. Thanks for the feedback. julia > > > } > > > > static ssize_t show_cursor_blink(struct device *device, > > @@ -3506,7 +3506,7 @@ static ssize_t show_cursor_blink(struct > > blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0; > > err: > > console_unlock(); > > - return snprintf(buf, PAGE_SIZE, "%d\n", blink); > > + return scnprintf(buf, PAGE_SIZE, "%d\n", blink); > > ditto for blink val > > > } > > > > static ssize_t store_cursor_blink(struct device *device, > > > > Best regards, > -- > Bartlomiej Zolnierkiewicz > Samsung R&D Institute Poland > Samsung Electronics > _______________________________________________ > kbuild-all mailing list -- kbuild-all@lists.01.org > To unsubscribe send an email to kbuild-all-leave@lists.01.org > From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 6BF72C43461 for ; Wed, 9 Sep 2020 07:05:17 +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 E814D21741 for ; Wed, 9 Sep 2020 07:05:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E814D21741 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=inria.fr 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 AE3676E9D5; Wed, 9 Sep 2020 07:05:09 +0000 (UTC) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 703396E817 for ; Tue, 8 Sep 2020 12:08:46 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.76,359,1592863200"; d="scan'208";a="466596022" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 14:08:43 +0200 Date: Tue, 8 Sep 2020 14:08:43 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Bartlomiej Zolnierkiewicz Subject: Re: [kbuild-all] Re: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings In-Reply-To: <3c266a0e-a2b9-ffde-0768-3b4fa89b0bfe@samsung.com> Message-ID: References: <202008101736.EtK0s7BQ%lkp@intel.com> <20200810092100.GA42813@2f5448a72a42> <3c266a0e-a2b9-ffde-0768-3b4fa89b0bfe@samsung.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 09 Sep 2020 07:04:23 +0000 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: kbuild-all@lists.01.org, kernel test robot , Daniel Vetter , linux-kernel@vger.kernel.org, Denis Efremov , dri-devel@lists.freedesktop.org, Alex Deucher , Nathan Chancellor , Sam Ravnborg , Peter Rosin , Qiujun Huang Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, 8 Sep 2020, Bartlomiej Zolnierkiewicz wrote: > > Hi, > > On 8/10/20 11:21 AM, kernel test robot wrote: > > From: kernel test robot > > > > drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf > > drivers/video/fbdev/core/fbcon.c:3484:8-16: WARNING: use scnprintf or sprintf > > > > > > From Documentation/filesystems/sysfs.txt: > > show() must not use snprintf() when formatting the value to be > > returned to user space. If you can guarantee that an overflow > > will never happen you can use sprintf() otherwise you must use > > scnprintf(). > > > > Generated by: scripts/coccinelle/api/device_attr_show.cocci > > > > Fixes: abfc19ff202d ("coccinelle: api: add device_attr_show script") > > CC: Denis Efremov > > Signed-off-by: kernel test robot > > --- > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > head: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7 > > commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script > > > > Please take the patch only if it's a positive warning. Thanks! > > > > fbcon.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > --- a/drivers/video/fbdev/core/fbcon.c > > +++ b/drivers/video/fbdev/core/fbcon.c > > @@ -3481,7 +3481,7 @@ static ssize_t show_rotate(struct device > > rotate = fbcon_get_rotate(info); > > err: > > console_unlock(); > > - return snprintf(buf, PAGE_SIZE, "%d\n", rotate); > > + return scnprintf(buf, PAGE_SIZE, "%d\n", rotate); > > buf length is at least PAGE_SIZE and rotate val is an int so > shouldn't this be converted to use sprintf() instead? The rule is evolving in this direction. Thanks for the feedback. julia > > > } > > > > static ssize_t show_cursor_blink(struct device *device, > > @@ -3506,7 +3506,7 @@ static ssize_t show_cursor_blink(struct > > blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0; > > err: > > console_unlock(); > > - return snprintf(buf, PAGE_SIZE, "%d\n", blink); > > + return scnprintf(buf, PAGE_SIZE, "%d\n", blink); > > ditto for blink val > > > } > > > > static ssize_t store_cursor_blink(struct device *device, > > > > Best regards, > -- > Bartlomiej Zolnierkiewicz > Samsung R&D Institute Poland > Samsung Electronics > _______________________________________________ > kbuild-all mailing list -- kbuild-all@lists.01.org > To unsubscribe send an email to kbuild-all-leave@lists.01.org > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8023701229274775872==" MIME-Version: 1.0 From: Julia Lawall To: kbuild-all@lists.01.org Subject: Re: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings Date: Tue, 08 Sep 2020 14:08:43 +0200 Message-ID: In-Reply-To: <3c266a0e-a2b9-ffde-0768-3b4fa89b0bfe@samsung.com> List-Id: --===============8023701229274775872== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue, 8 Sep 2020, Bartlomiej Zolnierkiewicz wrote: > > Hi, > > On 8/10/20 11:21 AM, kernel test robot wrote: > > From: kernel test robot > > > > drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or s= printf > > drivers/video/fbdev/core/fbcon.c:3484:8-16: WARNING: use scnprintf or s= printf > > > > > > From Documentation/filesystems/sysfs.txt: > > show() must not use snprintf() when formatting the value to be > > returned to user space. If you can guarantee that an overflow > > will never happen you can use sprintf() otherwise you must use > > scnprintf(). > > > > Generated by: scripts/coccinelle/api/device_attr_show.cocci > > > > Fixes: abfc19ff202d ("coccinelle: api: add device_attr_show script") > > CC: Denis Efremov > > Signed-off-by: kernel test robot > > --- > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.= git master > > head: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7 > > commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add d= evice_attr_show script > > > > Please take the patch only if it's a positive warning. Thanks! > > > > fbcon.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > --- a/drivers/video/fbdev/core/fbcon.c > > +++ b/drivers/video/fbdev/core/fbcon.c > > @@ -3481,7 +3481,7 @@ static ssize_t show_rotate(struct device > > rotate =3D fbcon_get_rotate(info); > > err: > > console_unlock(); > > - return snprintf(buf, PAGE_SIZE, "%d\n", rotate); > > + return scnprintf(buf, PAGE_SIZE, "%d\n", rotate); > > buf length is at least PAGE_SIZE and rotate val is an int so > shouldn't this be converted to use sprintf() instead? The rule is evolving in this direction. Thanks for the feedback. julia > > > } > > > > static ssize_t show_cursor_blink(struct device *device, > > @@ -3506,7 +3506,7 @@ static ssize_t show_cursor_blink(struct > > blink =3D (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0; > > err: > > console_unlock(); > > - return snprintf(buf, PAGE_SIZE, "%d\n", blink); > > + return scnprintf(buf, PAGE_SIZE, "%d\n", blink); > > ditto for blink val > > > } > > > > static ssize_t store_cursor_blink(struct device *device, > > > > Best regards, > -- > Bartlomiej Zolnierkiewicz > Samsung R&D Institute Poland > Samsung Electronics > _______________________________________________ > kbuild-all mailing list -- kbuild-all(a)lists.01.org > To unsubscribe send an email to kbuild-all-leave(a)lists.01.org > --===============8023701229274775872==--