Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754977Ab1BHQgF (ORCPT ); Tue, 8 Feb 2011 11:36:05 -0500 Received: from mail-bw0-f46.google.com ([209.85.214.46]:37378 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754717Ab1BHQgC (ORCPT ); Tue, 8 Feb 2011 11:36:02 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; b=JrMTs+uldYRa8PJPQbZslsGMSJJQ9mcR4vDRFhrcaX+VM213YwaNz5FYEqQ8/p8DjR ul9yGql1vsc/eLcEvxqwPSnx9HrdEN9t45yQ8rFPOmECcwkCV90M6dNzSN/8mZRKrbaY 9u/EtubWVRHJ3UZftxnQqxA2vIaLcjes7os1U= Date: Tue, 8 Feb 2011 19:35:31 +0300 From: Dan Carpenter To: Belisko Marek Cc: Marek Belisko , gregkh@suse.de, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/5] staging: ft1000: Fix coding style in write_blk_fifo() function. Message-ID: <20110208163531.GO4384@bicker> Mail-Followup-To: Dan Carpenter , Belisko Marek , Marek Belisko , gregkh@suse.de, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org References: <1296042555-29145-1-git-send-email-marek.belisko@open-nandra.com> <1296042555-29145-4-git-send-email-marek.belisko@open-nandra.com> <20110126130718.GN2721@bicker> <20110126143045.GP2721@bicker> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1339 Lines: 36 On Tue, Feb 08, 2011 at 02:40:49PM +0100, Belisko Marek wrote: > On Wed, Jan 26, 2011 at 3:30 PM, Dan Carpenter wrote: > > Also when it does: > > ? ? ? ?memcpy(ft1000dev->tx_buf, *pUcFile, byte_length); > > > > That should probably be: > > ? ? ? ?memcpy(ft1000dev->tx_buf, *pUcFile, word_length * 4); > No this shouldn't because before you have additional check: > if (byte_length && ((byte_length % 64) == 0)) > byte_length += 4; > > if (byte_length < 64) > byte_length = 68; > So in my opinion byte_length should stay. Yes. We make byte_length longer than the caller intended. The caller knows the size of the source buffer. We have to pad the length of the other buffer, but we should fill up the last part with zeroes instead of reading past the end of the source buffer. (I am not very familiar with the code and I haven't looked outside this function, so I may be wrong). Also I really bet that the thing where byte_length can't be a multiple of 64 is bogus. I've never heard of anything with a requirement like that. regards, dan carpenter -- 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/