From patchwork Thu Oct 10 12:25:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 3015701 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B19E1BF924 for ; Thu, 10 Oct 2013 12:25:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F07D202FF for ; Thu, 10 Oct 2013 12:25:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6801202FE for ; Thu, 10 Oct 2013 12:25:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754396Ab3JJMZo (ORCPT ); Thu, 10 Oct 2013 08:25:44 -0400 Received: from mail-qe0-f48.google.com ([209.85.128.48]:63933 "EHLO mail-qe0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753042Ab3JJMZn (ORCPT ); Thu, 10 Oct 2013 08:25:43 -0400 Received: by mail-qe0-f48.google.com with SMTP id d4so1813790qej.35 for ; Thu, 10 Oct 2013 05:25:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version:content-type:content-transfer-encoding; bh=JEaqsrDjyPXe/yFMaVIMS3u0yr5NAWd6ATaFqrVuJow=; b=nFdUcPrFXZSdrzau73JvxuxX+qyS1Gj2TDhwenJv3Zn0H7P6Urg8FZCDSd660klfUT PORwcfCVNJOveZVeyD0fG8WzUjXi18lSmElprOaS8rNU3uBBSz52KHtid+iNEE4r5+YM Hordk/ErBsb5/n00f4jS1ugJhH9+MFTQ2ERk9Ex5FAK/N+8U6hJHO6g2VZCtTqJluLOb 1opcVXbp1IcOII/I44yKp9rrqVw0wTTuSiN21b15TgVzm7TfI5KfWr7MgRxqjPZstq7h d1+S6UUD7yw6wSAwMpMLSfSWTMu/YUtUQxNfedlO0KrodnnjFXh1kAqVpY8WMWox5JuN G0hw== X-Gm-Message-State: ALoCoQnu7ynaApoysSNeXPwGxEdJJq6Ww6QILD00oUu/YrNXVp9l8MfSkqJpXvAVVZqcA/HhINjm X-Received: by 10.229.201.67 with SMTP id ez3mr21014991qcb.1.1381407942734; Thu, 10 Oct 2013 05:25:42 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-124-230.nc.res.rr.com. [107.15.124.230]) by mx.google.com with ESMTPSA id x1sm97814564qai.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 10 Oct 2013 05:25:41 -0700 (PDT) From: Jeff Layton To: linux-cifs@vger.kernel.org Subject: [PATCH v2] get/setcifsacl: fix bad bit-shifts Date: Thu, 10 Oct 2013 08:25:36 -0400 Message-Id: <1381407936-5534-1-git-send-email-jlayton@samba.org> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 A Coverity scan turned up this warning: 1. cifs-utils-6.2/setcifsacl.c:578:result_independent_of_operands – "(x & 0xff0000000000ULL) >> 48" is 0 regardless of the values of its operands. This occurs as the operand of assignment. ...which is entirely true. That shift should be 40 bits, not 48. Also fix a similar bug in getcifsacl.c. Signed-off-by: Jeff Layton --- getcifsacl.c | 2 +- setcifsacl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/getcifsacl.c b/getcifsacl.c index b8998ef..33f36b4 100644 --- a/getcifsacl.c +++ b/getcifsacl.c @@ -198,7 +198,7 @@ print_sid_raw: id_auth_val += (unsigned long long)csid->authority[3] << 16; id_auth_val += (unsigned long long)csid->authority[2] << 24; id_auth_val += (unsigned long long)csid->authority[1] << 32; - id_auth_val += (unsigned long long)csid->authority[0] << 48; + id_auth_val += (unsigned long long)csid->authority[0] << 40; /* * MS-DTYP states that if the authority is >= 2^32, then it should be diff --git a/setcifsacl.c b/setcifsacl.c index ce708eb..7eeeaa6 100644 --- a/setcifsacl.c +++ b/setcifsacl.c @@ -575,7 +575,7 @@ raw_str_to_sid(const char *str, struct cifs_sid *csid) csid->authority[3] = (x & 0x000000ff0000ULL) >> 16; csid->authority[2] = (x & 0x0000ff000000ULL) >> 24; csid->authority[1] = (x & 0x00ff00000000ULL) >> 32; - csid->authority[0] = (x & 0xff0000000000ULL) >> 48; + csid->authority[0] = (x & 0xff0000000000ULL) >> 40; /* now read the the subauthorities and store as __le32 vals */ p = q + 1;