Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756303AbZDTSlz (ORCPT ); Mon, 20 Apr 2009 14:41:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753989AbZDTSlq (ORCPT ); Mon, 20 Apr 2009 14:41:46 -0400 Received: from bipbip.grupopie.com ([195.23.16.24]:43155 "EHLO bipbip.grupopie.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753985AbZDTSlp (ORCPT ); Mon, 20 Apr 2009 14:41:45 -0400 Message-ID: <49ECC1DF.3040401@grupopie.com> Date: Mon, 20 Apr 2009 19:41:35 +0100 From: Paulo Marques Organization: Grupo PIE User-Agent: Thunderbird 2.0.0.19 (X11/20081227) MIME-Version: 1.0 To: H Hartley Sweeten CC: linux-kernel@vger.kernel.org Subject: Re: Q: crypto/cipher.c References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1187 Lines: 40 H Hartley Sweeten wrote: > Hello all, Hi, > I have a question about the following code in crypto/cipher.c. > > static void cipher_crypt_unaligned(void (*fn)(struct crypto_tfm *, u8 *, > const u8 *), > struct crypto_tfm *tfm, > u8 *dst, const u8 *src) > { > unsigned long alignmask = crypto_tfm_alg_alignmask(tfm); > unsigned int size = crypto_tfm_alg_blocksize(tfm); > u8 buffer[size + alignmask]; > u8 *tmp = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); > > memcpy(tmp, src, size); > fn(tfm, tmp, tmp); > memcpy(dst, tmp, size); > } > > Doesn't the size of buffer need to be known at compile time for this > to actually work? Or do alignmask and size work out to be constants? > > This appears to be buggy. But I may just be missing something... It's a GCC extension: http://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html -- Paulo Marques - www.grupopie.com "All generalizations are false." -- 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/