From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Layton Subject: Re: CIFS kernel module bug Date: Fri, 30 Sep 2011 14:04:09 -0400 Message-ID: <20110930140409.51c1a94c@tlielax.poochiereds.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, LKML , PWF Linux To: Anton Altaparmakov Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-cifs.vger.kernel.org On Fri, 30 Sep 2011 14:58:58 +0100 Anton Altaparmakov wrote: > Hi, >=20 > Looking at the current kernel (in Linus' repository on github) there = is a silly logic bug in the cifs module in fs/cifs/cifsfs.c::cifs_llsee= k() there is this bit of code: >=20 > /* > * origin =3D=3D SEEK_END || SEEK_DATA || SEEK_HOLE =3D> we must rev= alidate > * the cached file length > */ > if (origin !=3D SEEK_SET || origin !=3D SEEK_CUR) { >=20 > The logical or should be a logical and, i.e. this should be: >=20 > if (origin !=3D SEEK_SET && origin !=3D SEEK_CUR) { >=20 > As the code is at present that line is ALWAYS true because origin is = ALWAYS either !=3D SEEK_SET or !=3D SEEK_CUR as if it equals one it can= not equal the other and vice versa=E2=80=A6 >=20 > So at the moment it always does the revalidation instead of only for = SEEK_END, SEEK_DATA, and SEEK_HOLE. >=20 > Best regards, >=20 > Anton Haha, good catch. Care to roll up a patch to fix that? --=20 Jeff Layton