From patchwork Fri Sep 1 08:52:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9933769 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 14D336016C for ; Fri, 1 Sep 2017 08:52:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 065F6285B7 for ; Fri, 1 Sep 2017 08:52:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE7C8285D8; Fri, 1 Sep 2017 08:52:52 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 83AD8285B7 for ; Fri, 1 Sep 2017 08:52:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751645AbdIAIwu (ORCPT ); Fri, 1 Sep 2017 04:52:50 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:51575 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751641AbdIAIws (ORCPT ); Fri, 1 Sep 2017 04:52:48 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v818qfwO030358 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Sep 2017 08:52:42 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v818qfKM026988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Sep 2017 08:52:41 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v818qeuq022734; Fri, 1 Sep 2017 08:52:41 GMT Received: from mwanda (/197.157.0.49) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 01 Sep 2017 01:52:39 -0700 Date: Fri, 1 Sep 2017 11:52:25 +0300 From: Dan Carpenter To: John Johansen Cc: James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] apparmor: Fix harmless off by one in map_signal_num() Message-ID: <20170901085225.dpuirzpj7aq3yyim@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170609 (1.8.3) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This patch has no effect on runtime. The sig_map[] array has MAXMAPPED_SIG (35) members so my static checker complains that the <= should be <. But in this case it's not possible for "sig" to be more than 31 because of the "else if (sig >= SIGRTMIN)" condition since SIGRTMIN is 32. The last three elements, 32-34, of sig_map[] are empty so this code works as designed. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c index 66fb9ede9447..5091c78062e4 100644 --- a/security/apparmor/ipc.c +++ b/security/apparmor/ipc.c @@ -128,7 +128,7 @@ static inline int map_signal_num(int sig) return SIGUNKNOWN; else if (sig >= SIGRTMIN) return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */ - else if (sig <= MAXMAPPED_SIG) + else if (sig < MAXMAPPED_SIG) return sig_map[sig]; return SIGUNKNOWN; }