Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752851AbbETHL5 (ORCPT ); Wed, 20 May 2015 03:11:57 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:33686 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752002AbbETHLy (ORCPT ); Wed, 20 May 2015 03:11:54 -0400 Message-ID: <555C33B6.3090600@suse.cz> Date: Wed, 20 May 2015 09:11:50 +0200 From: Jiri Slaby User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Minfei Huang , Jiri Kosina CC: 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 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> In-Reply-To: <20150520015143.GA38414@dhcp-128-78.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1213 Lines: 42 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. > ---------------------------------- > } > } thanks, -- js suse labs -- 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/