From patchwork Thu Feb 27 13:35:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 230209 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 D5EA2C76567 for ; Thu, 27 Feb 2020 14:38:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4FE024656 for ; Thu, 27 Feb 2020 14:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582814298; bh=S+s3cWclEBY8U+vBbH0trtzvecUl92KL8gjlYd0sTYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=oTPNPDvLGeVIl/7jUTLu6N7KZ/TMJvG34aexC0ruNkMGB+554Fp47GqO4/S8RJQ0f b4/334ml6sQQ1N6veL/6onMypEfXokMwIBw++SblrPo9vQpoCsWEjHleWj3AE//hH/ XZ+2cp7651Ev2xxsOHsWR7q2ym1Qi/BtTvwnAyrg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731883AbgB0N4b (ORCPT ); Thu, 27 Feb 2020 08:56:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:57054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729484AbgB0N4a (ORCPT ); Thu, 27 Feb 2020 08:56:30 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C37424691; Thu, 27 Feb 2020 13:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582811790; bh=S+s3cWclEBY8U+vBbH0trtzvecUl92KL8gjlYd0sTYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ekC10kHxzDFA86LaRee7vySzhFuy5mjrtcOYZ89Uir27KgAkt9VEqBm+ifL3kAm6T e3HEglIoCrbrRQYCK/NlXPKvexMm0Gs2KH1NamLhGXGoNZZcEDhiC1HBJWEH0+JPVE fq00RUZKvMFlEWuwfSuwxN2YGSrp7ZQtBuu2nfgk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Li , Harry Wentland , Sam Ravnborg , Dingchen Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 4.14 101/237] drm: remove the newline for CRC source name. Date: Thu, 27 Feb 2020 14:35:15 +0100 Message-Id: <20200227132304.382135185@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132255.285644406@linuxfoundation.org> References: <20200227132255.285644406@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dingchen Zhang [ Upstream commit 72a848f5c46bab4c921edc9cbffd1ab273b2be17 ] userspace may transfer a newline, and this terminating newline is replaced by a '\0' to avoid followup issues. 'len-1' is the index to replace the newline of CRC source name. v3: typo fix (Sam) v2: update patch subject, body and format. (Sam) Cc: Leo Li Cc: Harry Wentland Cc: Sam Ravnborg Signed-off-by: Dingchen Zhang Reviewed-by: Sam Ravnborg Signed-off-by: Alex Deucher Link: https://patchwork.freedesktop.org/patch/msgid/20190610134751.14356-1-dingchen.zhang@amd.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_debugfs_crc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 2901b7944068d..6858c80d2eb50 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -101,8 +101,8 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf, if (IS_ERR(source)) return PTR_ERR(source); - if (source[len] == '\n') - source[len] = '\0'; + if (source[len - 1] == '\n') + source[len - 1] = '\0'; spin_lock_irq(&crc->lock);