Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757964AbbEWNT4 (ORCPT ); Sat, 23 May 2015 09:19:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39009 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757812AbbEWNTy (ORCPT ); Sat, 23 May 2015 09:19:54 -0400 Date: Sat, 23 May 2015 21:23:09 +0800 From: Minfei Huang To: Jiri Slaby Cc: Minfei Huang , Jiri Kosina , live-patching@vger.kernel.org, jpoimboe@redhat.com, sjenning@redhat.com, vojtech@suse.cz, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] livepatch: introduce patch/func-walking helpers Message-ID: <20150523132309.GA8636@dhcp-128-1.nay.redhat.com> References: <1432029679-9763-1-git-send-email-jslaby@suse.cz> <1432029679-9763-2-git-send-email-jslaby@suse.cz> <20150519122724.GA37748@dhcp-128-78.nay.redhat.com> <20150520015143.GA38414@dhcp-128-78.nay.redhat.com> <555C33B6.3090600@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <555C33B6.3090600@suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1508 Lines: 48 On 05/20/15 at 09:11am, Jiri Slaby wrote: > On 05/20/2015, 03:51 AM, Minfei Huang wrote: > > Sure. Sorry for confuse you with my comment. > > Oh, I see now, but: > > > list_for_each_entry(patch, &klp_patches, list) { > > for (obj = patch->objs; obj->funcs; obj++) { > > ---------------------------------- > > We get the fisrt object from the patch, then we break the loop. The code is more clearly to > > use "if", instead of the loop. > > ---------------------------------- > > if (!klp_is_module(obj) || strcmp(obj->name, mod->name)) > > continue; > > See 'continue' here. This *is* a loop and we do not fetch the first > object. We look for the one with the same name. > > > if (action == MODULE_STATE_COMING) { > > obj->mod = mod; > > klp_module_notify_coming(patch, obj); > > } else /* MODULE_STATE_GOING */ > > klp_module_notify_going(patch, obj); > > > > break; > > ---------------------------------- > > Here we break the loop. > > Only if we found the one. > Hi, Jiri. Ooops! Since it is impossible for the differect objects which have the some name in one patch, it is right to break the loop once we find a matched object. It confuses me with the logic in __klp_enable_patch. Thanks for your explanation. Thanks Minfei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/