From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 20 May 2013 18:52:24 -0300 From: Gustavo Padovan To: Chen Gang Cc: Jiri Kosina , David Herrmann , Marcel Holtmann , Johan Hedberg , David Miller , andrei.emeltchenko@intel.com, "linux-bluetooth@vger.kernel.org" , netdev Subject: Re: [PATCH v3] Bluetooth: hidp: using strlcpy instead of strncpy, also beautify code. Message-ID: <20130520215224.GE17712@joana> References: <518906A8.7060708@asianux.com> <5189A417.503@asianux.com> <5189C7C6.8090408@asianux.com> <51904ACF.6010904@asianux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <51904ACF.6010904@asianux.com> List-ID: Hi Chen, * Chen Gang [2013-05-13 10:07:11 +0800]: > > For NUL terminated string, need always let it ended by zero. > > Since have already called memcpy() to initialize 'ci', so need not > redundant initialization. > > Better use ''if(session->hid) {} else if(session->input) {}"" instead > of ''if(session->hid) {}; if(session->input) {};'' > > Signed-off-by: Chen Gang > --- > net/bluetooth/hidp/core.c | 14 ++++---------- > 1 files changed, 4 insertions(+), 10 deletions(-) Sorry for the big delay on this, patches has now been applied to bluetooth-next. Thanks all. Gustavo From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gustavo Padovan Subject: Re: [PATCH v3] Bluetooth: hidp: using strlcpy instead of strncpy, also beautify code. Date: Mon, 20 May 2013 18:52:24 -0300 Message-ID: <20130520215224.GE17712@joana> References: <518906A8.7060708@asianux.com> <5189A417.503@asianux.com> <5189C7C6.8090408@asianux.com> <51904ACF.6010904@asianux.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jiri Kosina , David Herrmann , Marcel Holtmann , Johan Hedberg , David Miller , andrei.emeltchenko-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, "linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , netdev To: Chen Gang Return-path: Content-Disposition: inline In-Reply-To: <51904ACF.6010904-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org> Sender: linux-bluetooth-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: netdev.vger.kernel.org Hi Chen, * Chen Gang [2013-05-13 10:07:11 +0800]: > > For NUL terminated string, need always let it ended by zero. > > Since have already called memcpy() to initialize 'ci', so need not > redundant initialization. > > Better use ''if(session->hid) {} else if(session->input) {}"" instead > of ''if(session->hid) {}; if(session->input) {};'' > > Signed-off-by: Chen Gang > --- > net/bluetooth/hidp/core.c | 14 ++++---------- > 1 files changed, 4 insertions(+), 10 deletions(-) Sorry for the big delay on this, patches has now been applied to bluetooth-next. Thanks all. Gustavo