From patchwork Thu Feb 4 11:40:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 8220201 Return-Path: X-Original-To: patchwork-linux-fsdevel@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 18145BEEE5 for ; Thu, 4 Feb 2016 11:40:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4FEE6200E0 for ; Thu, 4 Feb 2016 11:40:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 034E320390 for ; Thu, 4 Feb 2016 11:40:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933884AbcBDLkT (ORCPT ); Thu, 4 Feb 2016 06:40:19 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:31426 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933871AbcBDLkR (ORCPT ); Thu, 4 Feb 2016 06:40:17 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u14BeFNB019853 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Feb 2016 11:40:16 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u14BeFb6021450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 4 Feb 2016 11:40:15 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u14BeFSI007649; Thu, 4 Feb 2016 11:40:15 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 04 Feb 2016 03:40:15 -0800 Date: Thu, 4 Feb 2016 14:40:09 +0300 From: Dan Carpenter To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] fs/compat: fix a bug in do_ncp_super_data_conv() Message-ID: <20160204114009.GB11239@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 We are trying to copy the c_n->mounted_vol[] array and the three integer struct members that follow it. The problem is that there is a 3 byte struct hole after c_n->mounted_vol[] so we don't copy the lower 3 bytes of c_n->flags. I fixed it by doing the assignments one at a time. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" 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/fs/compat.c b/fs/compat.c index a71936a..355ab04 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -693,7 +693,11 @@ static void *do_ncp_super_data_conv(void *raw_data) n->file_mode = c_n->file_mode; n->gid = c_n->gid; n->uid = c_n->uid; - memmove (n->mounted_vol, c_n->mounted_vol, (sizeof (c_n->mounted_vol) + 3 * sizeof (unsigned int))); + memmove(n->mounted_vol, c_n->mounted_vol, + sizeof(c_n->mounted_vol)); + n->time_out = c_n->time_out; + n->retry_count = c_n->retry_count; + n->flags = c_n->flags; n->wdog_pid = c_n->wdog_pid; n->mounted_uid = c_n->mounted_uid; } else if (version == 4) {