Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031888AbcCQSAg (ORCPT ); Thu, 17 Mar 2016 14:00:36 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:32769 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967390AbcCQSAd (ORCPT ); Thu, 17 Mar 2016 14:00:33 -0400 From: Nicolai Stange To: Herbert Xu Cc: Tadeusz Struk , Michal Marek , Andrzej Zaborowski , Stephan Mueller , Arnd Bergmann , linux-kernel@vger.kernel.org, Nicolai Stange Subject: [PATCH 0/8] lib/mpi: bug fixes and cleanup Date: Thu, 17 Mar 2016 18:59:58 +0100 Message-Id: <1458237606-4954-1-git-send-email-nicstange@gmail.com> X-Mailer: git-send-email 2.7.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1632 Lines: 56 With linux-next-20160317, KASAN splats for both, mpi_write_sgl() and mpi_read_buffer(). While the first isn't dramatic on x86 (as long as it doesn't fault), the latter potentially overwrites unrelated memory. These two issues are fixed by [4/8] ("lib/mpi: mpi_write_sgl(): fix out-of-bounds stack access") and [8/8] ("lib/mpi: mpi_read_buffer(): fix buffer overflow") While reviewing the code, I found another bug, c.f. [1/8] ("lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs") The rest are cleanup/style patches I couldn't hold back ;) There is still room for improvement in that the leading zero handling could get easily moved out of the loop, but that's not the business of this series. Specifically. this patchset fixes 2d4d1eea540b ("lib/mpi: Add mpi sgl helpers") and 9cbe21d8f89d ("lib/mpi: only require buffers as big as needed for the integer") This series is applicable to linux-next-20160317. Nicolai Stange (8): lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs lib/mpi: mpi_write_sgl(): fix style issue with lzero decrement lib/mpi: mpi_write_sgl(): purge redundant pointer arithmetic lib/mpi: mpi_write_sgl(): fix out-of-bounds stack access lib/mpi: mpi_write_sgl(): replace open coded endian conversion lib/mpi: mpi_read_buffer(): optimize skipping of leading zero limbs lib/mpi: mpi_read_buffer(): replace open coded endian conversion lib/mpi: mpi_read_buffer(): fix buffer overflow lib/mpi/mpicoder.c | 91 ++++++++++++++++++++---------------------------------- 1 file changed, 33 insertions(+), 58 deletions(-) -- 2.7.2