From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26C37265629 for ; Tue, 28 Apr 2026 09:06:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777367189; cv=none; b=rB+PYKR9r7WEam7P9zyMdoiMre7ZBSK12E8Q7DTeyQ1jQ7J+G9Y9032eirpulV0FbB6XGGU5yRfRFUIJzjaQoLzgNLkkLMMUpmNXV3lDOOowgaL2+J6rAbT49TVxCFkCjEJ6srMUiglW1zCzsMxmSWR/lzy89v9junPE5okSBRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777367189; c=relaxed/simple; bh=OMcjGSWiBAf94VdMgisQu6JNTXzpX+koxRNIDsm60uQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Sgm1I45Mn6t6G3OyK2xBtuADS+e6C8OZbvczHuGTTVAZPnNr2CZEnFZexVv/lU9Lqy7PTZI+eAC0HlpEGpxs1wfIeiPZvKO4CXd3Fgn6DuRkr6HJNcFEIOVd3fOTx8rQrZqoZdfHCo6YEu93jcmakj1kEu5JXrNXnM62RLpQWQU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Y/lvTcDJ; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y/lvTcDJ" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5a525aedb24so10915225e87.2 for ; Tue, 28 Apr 2026 02:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777367186; x=1777971986; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=iMNW0hXyddvQe3Eu+jgv4g1Nplvm+O5VkEzCtxZlUOY=; b=Y/lvTcDJFliK2eVv6/jb3Ek54H/+EvVLsE1C1aMR1/9BXb/uh4W6KqE1VcfgcnAvp1 gyKXyZt+3bAuQkKtDedSTyRT6xdqwI6/3V43yRLchYwMN/V2c97irFm0mlCkyjFmqT8b AsHKX54nk3uBqBH6Rvxja1/T24lU7oz4tzhBAL9CnnsGXrJvWUm3Z1J84BtbGbrxSHkz zIZuGUFaLCDUDPtU/AtkzdFubdB8oVHliCBXHmNRK2yQJIwYZsY3TGbw/NELn00S1/8O VMTOgk8ggI9yS88FupMxTjNPnsCbNouVh5AUKOlkpP+nYw0vyh++R3KMOzlvdZe7MZ0Z JyWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777367186; x=1777971986; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iMNW0hXyddvQe3Eu+jgv4g1Nplvm+O5VkEzCtxZlUOY=; b=HGxTV6kfB2uiv73FWDowqTcSy9XBsMMJbkSfhx7FOWRnLwCx5um27dch9xyPcePHPs Cgyve2z5jusGC6L9VTjDRAY9Zgoa89bhM0JTm8qmFe16mJTP0wNS9AYvcVScwyO4mUGL 7/C+syxE0RBgg6cj4Wvh2awWtsI99Oy2BWRwxNa0sSIqTGwla5sjp2+3ALpBuyspNT+v r8D8jBehBgDLim3lioXohypnYGYJ6Deph1dB4/9vR0+vnIY94lFwKFR9ZPplC5ZrcG8T H5rMvIhdEzre6r8liVMDS/fNPBnv38ZEXKub3LOWdduY7xuIO54jDpePBhHf1GsyZWk4 YN3g== X-Forwarded-Encrypted: i=1; AFNElJ8KCy6uY5ixk/SzZHwlE80cb5AxEtiMUWCpCrA64xq2JTqBwnq6QDoIsoIAWszQM+/0a2VnS2UQsg3df2g=@vger.kernel.org X-Gm-Message-State: AOJu0YyG25pRH/eIQYjGU1J/obuyaTo3hW71vcM5A0VQyHwD8qxYCvRx W6zwB/xvBBHR8g0avx7t4dTOfBVRUYpyeiLRH8ICwZMlw0olry2oWhDPLxUSAQ== X-Gm-Gg: AeBDiesNFPn25RVCgxo8rVbklgA+FbmP/NawD8vT0SNiJgX6a0c2R+7oMKtW4aMGW7y 0+fcthafxlkM4o83/5/2k/KwwTcVdO4dQFi01MIYltBt1gRvUPgV/TgCQQFNwDpetxcSvKWvxSx Fvvl11L7z2MmJOVxFa532h2Q63u6VERcf8azVpU6GzbpuOSBiTt+96Att+I9jDjb28VLvKOXWGN Gg1HSX1QbI9dJHG678ZyKKZZwPx8WNC/HkySI/16U2LXKdJz+wE7BIJ6KL/jal+4uSd+lDkJviH aLz9qWN5ahyW2VNUDbfh8VfM+CrJNlBhZUjKv/xQUQOmsYPOzUmvEg4laOEFcwV+3P3QrzIPmQD HD4GIQC1jvmRHjZYdzfGj57gr9sNgkWNMma3LQ3Ne6RMuVZpHs0S2mw8GzOcTP0ajf+9nCqns2s cUcXULIARmhn6ucfFba4BOyxQIafhJ6efCAISInBcjxGSnH9JrHrfAW0fQb0G+WEA7YW+PZS4= X-Received: by 2002:a05:6512:3d1e:b0:5a4:d0a:8ed5 with SMTP id 2adb3069b0e04-5a74661b77dmr950825e87.39.1777367185882; Tue, 28 Apr 2026 02:06:25 -0700 (PDT) Received: from [192.168.1.89] (c-85-228-44-247.bbcust.telenor.se. [85.228.44.247]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a7462ca563sm459466e87.1.2026.04.28.02.06.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Apr 2026 02:06:25 -0700 (PDT) Message-ID: Date: Tue, 28 Apr 2026 11:05:11 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] char: xillybus: use strscpy() in init_chrdev Content-Language: en-US To: Thorsten Blum Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org References: <20260427173730.418592-3-thorsten.blum@linux.dev> From: Eli Billauer In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 28/04/2026 10:55, Thorsten Blum wrote: >> And even though it's formally OK to use strscpy() with two arguments, and >> let the compilation machinery find out the length of the char array, I have >> to admit that it gives me the chills. Buffer overflow and that. > You probably mean strcpy()? strscpy() is safe regarding buffer overflow. I meant strscpy(). We agree that it's formally safe to use, but I get a really bad feeling with not having the length of the buffer explicitly written out in the function call. One could argue that it's better to let the machine figure out the length of the buffer instead of using UNITNAMELEN (because I'm a human and I can err), but in this specific case, UNITNAMELEN is relied upon anyhow a few rows later. This is all about coding style. The main point is that I see this patch as a negligible optimization in CPU cycles coming with a slight obfuscation of the code's readability. A bit of "if it ain't broke, don't fix it". Regards, Eli