Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752327AbcD2Ife (ORCPT ); Fri, 29 Apr 2016 04:35:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:40844 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbcD2Ifc (ORCPT ); Fri, 29 Apr 2016 04:35:32 -0400 Date: Fri, 29 Apr 2016 10:35:29 +0200 (CEST) From: Jiri Kosina X-X-Sender: jkosina@pobox.suse.cz To: Jessica Yu cc: Miroslav Benes , jpoimboe@redhat.com, pmladek@suse.com, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: klp: make object/func-walking helpers more robust In-Reply-To: <20160428182131.GA22885@packer-debian-8-amd64.digitalocean.com> Message-ID: References: <1461854048-31473-1-git-send-email-mbenes@suse.cz> <20160428182131.GA22885@packer-debian-8-amd64.digitalocean.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1020 Lines: 28 On Thu, 28 Apr 2016, Jessica Yu wrote: > > #define klp_for_each_object(patch, obj) \ > > - for (obj = patch->objs; obj->funcs; obj++) > > + for (obj = patch->objs; obj->funcs || obj->name; obj++) > > Remember that for patches to vmlinux, obj->name and obj->mod will also > both be NULL. So if someone happens to forget to fill in obj->funcs > for a vmlinux patch, we won't catch that case here. Perhaps we need a > better way of determining whether we've reached the end of the array, > or determining that the struct is truly empty.. I'd rather not over-compilcate it. Admittedly, the change in the termination condition catches most of the errors made by the patch author, but not all. But there are many other places in the kernel where inserting an empty item into the middle of statically initialized array will make the whole thing explode, so let's not try to be more clever than necessary. I plan to queue Miroslav's patch unless there are serious objections raised. Thanks, -- Jiri Kosina SUSE Labs