Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751768AbcCKSfc (ORCPT ); Fri, 11 Mar 2016 13:35:32 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:40247 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbcCKSf1 (ORCPT ); Fri, 11 Mar 2016 13:35:27 -0500 Subject: Re: [PATCH net-next] bpf: avoid copying junk bytes in bpf_get_current_comm() To: Daniel Borkmann , "David S . Miller" References: <1457582553-395600-1-git-send-email-ast@fb.com> <56E29CDA.5010004@iogearbox.net> <56E2FE44.7040904@fb.com> <56E3083E.6010001@iogearbox.net> CC: Tobias Waldekranz , Brendan Gregg , , , From: Alexei Starovoitov Message-ID: <56E30FDE.3050702@fb.com> Date: Fri, 11 Mar 2016 10:35:10 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56E3083E.6010001@iogearbox.net> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-11_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 338 Lines: 8 On 3/11/16 10:02 AM, Daniel Borkmann wrote: > Would strscpy() help in this case (see 30035e45753b ("string: provide > strscpy()"))? I've looked at it too, but 990486c8af04 scared me a little, it's not easily backport-able and mainly I don't think it's faster than strlcpy for small strings like comm. memcpy going to be faster for sure.