From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Fri, 13 Sep 2013 12:56:05 +0000 Subject: Re: [patch 3/4] skd: use strncpy() as a cleanup Message-Id: <20130913125605.GL25896@mwanda> List-Id: References: <20130913080539.GG19211@elgon.mountain> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Geert Uytterhoeven Cc: Jens Axboe , Jeff Moyer , Ramprasad Chinthekindi , Akhil Bhansali , "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" On Fri, Sep 13, 2013 at 02:03:23PM +0200, Geert Uytterhoeven wrote: > On Fri, Sep 13, 2013 at 10:05 AM, Dan Carpenter > > + strncpy(inq.driver_version, DRV_VER_COMPL, > > + min(sizeof(inq.driver_version), strlen(DRV_VER_COMPL))); > > This does the exact same thing as memcpy(), right? So why not use that? > memcpy() has much simpler semantics than strncpy(). You're right. I've redone this. regards, dan carpenter From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755676Ab3IMM4U (ORCPT ); Fri, 13 Sep 2013 08:56:20 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:36557 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750842Ab3IMM4S (ORCPT ); Fri, 13 Sep 2013 08:56:18 -0400 Date: Fri, 13 Sep 2013 15:56:05 +0300 From: Dan Carpenter To: Geert Uytterhoeven Cc: Jens Axboe , Jeff Moyer , Ramprasad Chinthekindi , Akhil Bhansali , "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" Subject: Re: [patch 3/4] skd: use strncpy() as a cleanup Message-ID: <20130913125605.GL25896@mwanda> References: <20130913080539.GG19211@elgon.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 13, 2013 at 02:03:23PM +0200, Geert Uytterhoeven wrote: > On Fri, Sep 13, 2013 at 10:05 AM, Dan Carpenter > > + strncpy(inq.driver_version, DRV_VER_COMPL, > > + min(sizeof(inq.driver_version), strlen(DRV_VER_COMPL))); > > This does the exact same thing as memcpy(), right? So why not use that? > memcpy() has much simpler semantics than strncpy(). You're right. I've redone this. regards, dan carpenter