From patchwork Thu Nov 19 12:38:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 7656911 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7918CBF90C for ; Thu, 19 Nov 2015 12:39:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80B7F206A5 for ; Thu, 19 Nov 2015 12:39:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 727CC2069E for ; Thu, 19 Nov 2015 12:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750857AbbKSMj3 (ORCPT ); Thu, 19 Nov 2015 07:39:29 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37730 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750815AbbKSMj2 (ORCPT ); Thu, 19 Nov 2015 07:39:28 -0500 Received: by wmww144 with SMTP id w144so114661602wmw.0; Thu, 19 Nov 2015 04:39:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=G3X/ycP4NyXaAyNR2qTEIMM0B/54S5SKdy5HUXEWIJ0=; b=d947EPeMiVzz++s7L41qq1F7B6pdoH/ylWNs56ZD8syOxKDGCuo/yGmW8xlGBb+n7I DhWETZtP7VnvptEjRc6/uChCNTX+3XrkLAxFdGIk2S1hL2xo2OSl7BHylnvS3DtfeJdZ hxYOd1cjXsaOuqGwOKcHC/d/Qyv8yL5D58gycBkk2JkPoamSIKBjWfxxZTrjxKS7w9Bc 757CcLBr+tZmWQfnih3Wknm5cyPs2wKmpwsrBl7fXrP1mKt+lJcW5mK0hqSD3m8WDnu8 ga5WA70W1RZ2x+qXoYQoEE3nkvh/ba4EMifDXmdy+Z9hsrjvHHhLMga4IyP5HxdQVG/q 4vYg== X-Received: by 10.194.71.202 with SMTP id x10mr9237425wju.169.1447936767171; Thu, 19 Nov 2015 04:39:27 -0800 (PST) Received: from Red.local (ANice-651-1-376-123.w86-193.abo.wanadoo.fr. [86.193.8.123]) by smtp.googlemail.com with ESMTPSA id u134sm7059722wmd.0.2015.11.19.04.39.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Nov 2015 04:39:26 -0800 (PST) From: LABBE Corentin To: davem@davemloft.net, herbert@gondor.apana.org.au Cc: LABBE Corentin , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] crypto: sahara: set nb_[in|out]_sg as signed int Date: Thu, 19 Nov 2015 13:38:17 +0100 Message-Id: <1447936699-26854-1-git-send-email-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.4.10 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The two unsigned int variables nb_in_sg and nb_out_sg can be assigned signed value (-EINVAL) from sg_nents_for_len(). Furthermore they are used only by dma_map_sg and dma_unmap_sg which wait for an signed int, so they must be set as int. Fixes: 6c2b74d4774f ("crypto: sahara - check return value of sg_nents_for_len") Reported-by: Dan Carpenter Signed-off-by: LABBE Corentin --- drivers/crypto/sahara.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index ea9f56a..cc738f3 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -228,9 +228,9 @@ struct sahara_dev { size_t total; struct scatterlist *in_sg; - unsigned int nb_in_sg; + int nb_in_sg; struct scatterlist *out_sg; - unsigned int nb_out_sg; + int nb_out_sg; u32 error; };