From patchwork Thu Dec 21 15:55:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasyl Gomonovych X-Patchwork-Id: 10127883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1725B60390 for ; Thu, 21 Dec 2017 15:56:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A58F29D18 for ; Thu, 21 Dec 2017 15:56:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F343029D20; Thu, 21 Dec 2017 15:56:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A88A329D18 for ; Thu, 21 Dec 2017 15:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751866AbdLUP4G (ORCPT ); Thu, 21 Dec 2017 10:56:06 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:46357 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751220AbdLUP4F (ORCPT ); Thu, 21 Dec 2017 10:56:05 -0500 Received: by mail-lf0-f67.google.com with SMTP id r143so28421764lfe.13; Thu, 21 Dec 2017 07:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9i7Mz2NiAIhY5HkONiBCFk+iyBnuPtaj6Cl/N9eYwA4=; b=E5gfKmBWfaA+g2xqAoXkruhtV7rY0Hw9Mp0krOZB81nuskMHcCfMr9ptf2EHD/7opX L6o/yT1vE9ZMVksYPbzz74VI+3b+ZoWztnryUB+4X9FMkUm2U2qIDd3CeHIUQMKYY2Wq yTTl4/PS2pE5/p7bTwTYTTjZKQXVcG9QHaWny6n1BT7RF+5f+gwirtHJ/zqmjDX+FbRA 6t8eDJohiXMt4EtUCHWXbL7UH1VTxyjBspWBBlNBa2cdTe+uf47+NQGgaJ0j8NW972HF dgy0fv0rfvvGYOvd0BzZ9yYi5Zb162uIckFMdkjvDiCeFlfH1F2NTcPv7sIuCBfKGEQm kQhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9i7Mz2NiAIhY5HkONiBCFk+iyBnuPtaj6Cl/N9eYwA4=; b=cZYOadDp3pH5U3krnDgERnJyVzBBjxHsPaiSsA4jpomIjuhMvrQUKlxT+eci+uYHJY z1xeTNb9XvI8A4bJPt9E0OyXAIAyUfy4khR3aWPo4F8Vh8cy9HmqGDSAg1/u+e9aGx3P wLMi1Fpn3Hc6wjp+cBkkrTXd63o4hL2Y+oHttKcf7uEOlDFv/JLOl93oX30pcohfKqIq A7aJZFGTt/rdpuxOg5HQbTEishezZzHWdb8po3YqpvBSyfLqFPpXKHL6lQ/JMg9RL0eX 8zQRLA8aGJtz4r5RoG9zcT9Y97kmLCEgMIimXHfdqZIrnJQE7exqkicd5cmlHJUHlsZz dPPQ== X-Gm-Message-State: AKGB3mJxX9sGkeqkh6bC9qOyIxoKtEclLA3HGM8Eh3YBRnV/J0TJsWX/ oMVStcRoC6zeAhPxXWtM9N8= X-Google-Smtp-Source: ACJfBotSueD/OBxWCFDsWStWLua7IZoaQ0mrci/Y+iyf5h2XU4S2lYhknx21T758tfSoEA5WwNTYhw== X-Received: by 10.25.17.23 with SMTP id g23mr6615501lfi.132.1513871763530; Thu, 21 Dec 2017 07:56:03 -0800 (PST) Received: from localhost.localdomain ([195.254.138.66]) by smtp.gmail.com with ESMTPSA id b25sm4088605lje.14.2017.12.21.07.56.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Dec 2017 07:56:02 -0800 (PST) From: Vasyl Gomonovych To: zohar@linux.vnet.ibm.com, dmitry.kasatkin@gmail.com, james.l.morris@oracle.com, serge@hallyn.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, gomonovych@gmail.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] ima: Fix warn potential negative subtraction from max Date: Thu, 21 Dec 2017 16:55:53 +0100 Message-Id: <1513871754-13943-1-git-send-email-gomonovych@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Found by smatch: security/integrity/ima/ima_queue.c:122 ima_add_digest_entry() warn: potential negative subtraction from max '(~0)- size' Signed-off-by: Vasyl Gomonovych --- security/integrity/ima/ima_queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/integrity/ima/ima_queue.c b/security/integrity/ima/ima_queue.c index a02a86d51102..446018478b81 100644 --- a/security/integrity/ima/ima_queue.c +++ b/security/integrity/ima/ima_queue.c @@ -116,7 +116,7 @@ static int ima_add_digest_entry(struct ima_template_entry *entry, } if (binary_runtime_size != ULONG_MAX) { - int size; + unsigned int size; size = get_binary_runtime_size(entry); binary_runtime_size = (binary_runtime_size < ULONG_MAX - size) ?