Received: by 10.213.65.68 with SMTP id h4csp785943imn; Fri, 23 Mar 2018 16:35:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELvdG2bhTBmhAvu+P9KhpV8SCRr4TxejaXb51ZzD/nVU+5ciK+XwaVcfwdZhjdIE19YfuMtd X-Received: by 10.98.157.7 with SMTP id i7mr15636893pfd.85.1521848135443; Fri, 23 Mar 2018 16:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521848135; cv=none; d=google.com; s=arc-20160816; b=qZdXOf4KpXQzC0BgEMj4+1inss8jyFISxc64DILAFQpKVtBVOR/W+oUmtjyGcwVoS4 V1vSH0EVhoWBu2oKR3YU77zFw2HmDsleQ2oH/KjWv1eYIUOx7qVEyUQwY7f0KrzlQiJb HnuudSCddkWzOKC49Yvu6UKWjr35v0x1RxyVF96OgMrcwC5GkvlW499Ezy2/HJABpXIl gJj/7TWAk2WHHZunlxcssQu90yd8axf3vkz/gLXce+mfpdpjpQIGAj9ose6HBPvTUJ1K Mf1L/MlLPZ1BhT4hwAfDXT273oiYy0N0mY0ShWjPxxaEJEjF+9gjHvZz5+CN4HurQ0pS tjHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=EA1mjlk78MQkKOIQfNSDnf/S1FmbBX8BPgPbGMY7efY=; b=B/5CHbm6nl+qn9ZymKwnKWfe3xiQyL8TngA0QxQbwkkj/DRAUionaDuyh8GIXlOjdf 4yZsiwxvEWfhlB4FFGCJVHYVKkhN8AY3YVjS0mFHshg7q3s8PaZ3GLmmsCyN8DXrYBYm ckZFzjrMM6JKTlm8qafyM9eyrU/j0ykLPAKgqDp9RC0y3OOmOpeJFgwT57u0kd6ZpQNB gq5yHjcj5xXNJUiOe763H0/qjGZVFyh9/9CulNqBwuEzxkcAEEXMf1xVKOHoC7sY2tjd +O7TU29lzTDE9BLyeg7vV4l469ASYkS5LA+M64Lok2EpI9oHhtgYI7SruXb+5EK2gZuk AISw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8-v6si3484413plv.420.2018.03.23.16.35.20; Fri, 23 Mar 2018 16:35:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752318AbeCWXe2 (ORCPT + 99 others); Fri, 23 Mar 2018 19:34:28 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:45837 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752053AbeCWXeZ (ORCPT ); Fri, 23 Mar 2018 19:34:25 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1ezWCU-0005wn-SF; Fri, 23 Mar 2018 23:34:22 +0000 From: Colin King To: John Johansen , James Morris , "Serge E . Hallyn" , linux-security-module@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] apparmor: fix error returns checks by making size a ssize_t Date: Fri, 23 Mar 2018 23:34:22 +0000 Message-Id: <20180323233422.7856-1-colin.king@canonical.com> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently variable size is a unsigned size_t, hence comparisons to see if it is less than zero (for error checking) will always be false. Fix this by making size a ssize_t Detected by CoverityScan, CID#1466080 ("Unsigned compared against 0") Fixes: 8e51f9087f40 ("apparmor: Add support for attaching profiles via xattr, presence and value") Signed-off-by: Colin Ian King --- security/apparmor/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c index 57cc892e05a2..590b7e8cd21c 100644 --- a/security/apparmor/domain.c +++ b/security/apparmor/domain.c @@ -314,7 +314,7 @@ static int aa_xattrs_match(const struct linux_binprm *bprm, struct aa_profile *profile, unsigned int state) { int i; - size_t size; + ssize_t size; struct dentry *d; char *value = NULL; int value_size = 0, ret = profile->xattr_count; -- 2.15.1