Received: by 10.223.185.116 with SMTP id b49csp1030023wrg; Fri, 16 Feb 2018 11:06:56 -0800 (PST) X-Google-Smtp-Source: AH8x226oq/HeBzNtBH9xtPLkANa0lsIoJno3UikY0PWYtJhdeXtPsxWvplBxSU787s487Dmiodsw X-Received: by 10.98.216.137 with SMTP id e131mr6640255pfg.17.1518808016166; Fri, 16 Feb 2018 11:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518808016; cv=none; d=google.com; s=arc-20160816; b=olkzHyFcU4MJe3bA30rn4UxOhbhyjylvgP1cU+8TUh/1DnyY26ovAbpAEneUi/RFXJ 9HO7GGf09pPbViamh3Y8YZb5NH6Na1/8iwJZpi8fukNUDTRdMcvWC50qycMNxg/HmZre EiHUCxOE0KQAfjQ80oRpmf+hSlZtGR04w6T4274Tbe/p+P3cLBa4l9vshTLvSKpHmYGA OPk9cFPRlew5qPmzSsXrk52ZrFBPMDg9OvHW4lnwYrZ0owhJ1E4jRMy8IC86hu7uF/1X DtXr5E31Moy7gxsUYPsttN8UN9MvM5XsIoqqt5OvESwGpyMxo//lxD2s3fs9vIZLhI9A +XDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=px4xf3vkWb7Q9h/bRcWhB162SPW8ROuom1qYnQdWD6w=; b=b25OW6g42TgOVK+Hh6/rsDJJJS0fNIa6gejmsbazQacFm94dr0UpbzboqUc0V5J97R t2eCDBv8DltXiUj7M5CKBcbxtQkmhBJo2BcUA5n9pddD2BywKlddFu1ks+FSjr9AkzPs zMaFOVqnoQiB1usU4jKqJj9IzjVCyWzXqiGNXlUbT12zuOdlBqWqTDrXBxahhp0XR4vV BBvGOdP+byWjqSXElhaLKNyXH+yLjGN5pgf8pGqlWt+JeSoIf+WCutnjf3E93shZt00a kJtcg2R/4MkmKSXm3er7tKRkJiNlkBK70JcOq53ILxBEaDefcoFTNUeTxKMMP0sSQ57C bzRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u136si1318053pgc.784.2018.02.16.11.06.41; Fri, 16 Feb 2018 11:06:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966920AbeBPMhT (ORCPT + 99 others); Fri, 16 Feb 2018 07:37:19 -0500 Received: from mx2.suse.de ([195.135.220.15]:50603 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966628AbeBPMhS (ORCPT ); Fri, 16 Feb 2018 07:37:18 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6AA32AAB6; Fri, 16 Feb 2018 12:37:17 +0000 (UTC) Date: Fri, 16 Feb 2018 13:37:15 +0100 (CET) From: Jiri Kosina To: Xiongfeng Wang cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] HID: uhid: use strlcpy() instead of strncpy() In-Reply-To: <1515500612-191425-1-git-send-email-wangxiongfeng2@huawei.com> Message-ID: References: <1515500612-191425-1-git-send-email-wangxiongfeng2@huawei.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) 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, 9 Jan 2018, Xiongfeng Wang wrote: > From: Xiongfeng Wang > > gcc-8 reports > > drivers/hid/uhid.c: In function 'uhid_dev_create2': > ./include/linux/string.h:245:9: warning: '__builtin_strncpy' output may > be truncated copying 127 bytes from a string of length 127 > [-Wstringop-truncation] > > The compiler require that the input param 'len' of strncpy() should be > greater than the length of the src string, so that '\0' is copied as > well. We can just use strlcpy() to avoid this warning. Applied to for-4.17/upstream. -- Jiri Kosina SUSE Labs