From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752341AbcAZTSp (ORCPT ); Tue, 26 Jan 2016 14:18:45 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:30956 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752174AbcAZTSl (ORCPT ); Tue, 26 Jan 2016 14:18:41 -0500 Date: Tue, 26 Jan 2016 22:18:35 +0300 From: Dan Carpenter To: Viacheslav Dubeyko Cc: Chengyu Song , Andrew Morton , David Howells , Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [patch] hfs: fix hfs_readdir() Message-ID: <20160126191835.GD5273@mwanda> References: <20160126092611.GD15717@mwanda> <1453832336.2633.10.camel@slavad-ubuntu-14.04> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453832336.2633.10.camel@slavad-ubuntu-14.04> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hm, I completely didn't see that it was a union instead of a struct. I still think my fix is actually correct though. Now that you point out the union, I see that my change is equivalent to just removing the '&' char. - memcpy(&rd->key, &fd.key, sizeof(struct hfs_cat_key)); + memcpy(&rd->key, fd.key, sizeof(struct hfs_cat_key)); We don't want to copy sizeof(*fd.key) because that would write past the end of the destination struct. On Tue, Jan 26, 2016 at 10:18:56AM -0800, Viacheslav Dubeyko wrote: > Another worry could be the "search_key" field of the struct > hfs_find_data. I don't understand what you mean here. regards, dan carpenter