From: Ross Zwisler Subject: Re: [PATCH] SQUASHME: Streamline pmem.c Date: Thu, 26 Mar 2015 16:22:22 -0600 Message-ID: <1427408542.29730.13.camel@theros.lm.intel.com> References: <1427358764-6126-1-git-send-email-hch@lst.de> <55143A8B.2060304@plexistor.com> <55143B99.7060407@plexistor.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Christoph Hellwig , linux-nvdimm@ml01.01.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, axboe@kernel.dk To: Boaz Harrosh Return-path: In-Reply-To: <55143B99.7060407@plexistor.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Thu, 2015-03-26 at 19:02 +0200, Boaz Harrosh wrote: > static void pmem_do_bvec(struct pmem_device *pmem, struct page *page, > unsigned int len, unsigned int off, int rw, > sector_t sector) > { > void *mem = kmap_atomic(page); > + size_t pmem_off = sector << 9; > + > + BUG_ON(pmem_off >= pmem->size); This check should take 'len' into account so we don't copy off the end of our PMEM space. We should also just return -EIO back up to pmem_make_request() and have that fail the bio, as opposed to doing the drastic BUG_ON.