From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752549AbdJMFs4 (ORCPT ); Fri, 13 Oct 2017 01:48:56 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:48085 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751378AbdJMFsy (ORCPT ); Fri, 13 Oct 2017 01:48:54 -0400 X-Google-Smtp-Source: AOwi7QA+Ta0ZyTiFIYuIR5oDBvPnJ2O+7J3rpMdaSrBj5aaIbB5CyhQQOv1c6TDQia/5RtGwqkFLZQ== Subject: Re: [PATCH v2] bcache: safeguard a dangerous addressing in closure_queue To: Liang Chen , linux-bcache@vger.kernel.org Cc: i@coly.li, kent.overstreet@gmail.com, linux-kernel@vger.kernel.org References: <20171013053049.11875-1-liangchen.linux@gmail.com> From: Michael Lyle Message-ID: <95ddfc9f-b01e-3346-4ebf-d15d73644d35@lyle.org> Date: Thu, 12 Oct 2017 22:48:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171013053049.11875-1-liangchen.linux@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Liang-- Thanks for the quick turnaround. I've added this to bcache-for-next. On 10/12/2017 10:30 PM, Liang Chen wrote: > The use of the union reduces the size of closure struct by taking advantage > of the current size of its members. The offset of func in work_struct equals > the size of the first three members, so that work.work_func will just > reference the forth member - fn. > > This is smart but dangerous. It can be broken if work_struct or the other > structs get changed, and can be a bit difficult to debug. > > Signed-off-by: Liang Chen Reviewed-by: Michael Lyle -Mike