Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751230AbbESTWR (ORCPT ); Tue, 19 May 2015 15:22:17 -0400 Received: from mail.skyhub.de ([78.46.96.112]:37457 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbbESTWP (ORCPT ); Tue, 19 May 2015 15:22:15 -0400 Date: Tue, 19 May 2015 21:22:06 +0200 From: Borislav Petkov To: Andy Lutomirski Cc: "linux-kernel@vger.kernel.org" , Fenghua Yu , Dave Hansen , Thomas Gleixner , Denys Vlasenko , Ingo Molnar , Brian Gerst , "H. Peter Anvin" , Igor Mammedov , the arch/x86 maintainers , Prarit Bhargava Subject: Re: [PATCH] x86, cpuinfo x86_model_id whitespace cleanup Message-ID: <20150519192206.GN4641@pd.tnic> References: <1432050210-32036-1-git-send-email-prarit@redhat.com> <20150519181334.GM4641@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1168 Lines: 33 On Tue, May 19, 2015 at 11:44:41AM -0700, Andy Lutomirski wrote: > On May 19, 2015 11:13 AM, "Borislav Petkov" wrote: > > > > On Tue, May 19, 2015 at 01:25:59PM -0400, Brian Gerst wrote: > > > Using strlcpy in this manner could fail if it does larger than byte > > > copies and they overlap. > > > > Why? > > > > AFAICT, strlcpy() calls memcpy() and memcpy should handle overlapping > > buffers just fine. > > Are you thinking of memmove? I guess I'm trying to find out why don't we have a BIG FAT WARNING over memcpy saying not to use it with overlapping buffers and larger than byte sizes. Or maybe this is something everyone, except me, just knows and that's a "Doh, Boris, of course!". Btw, can we still avoid using the temporary buffer and use strncpy() instead? AFAICT, that does byte copies, from looking at the asm. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/