linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Manfred Spraul <manfred@colorfullife.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/5] ipc,shm: move BUG_ON check into shm_lock
Date: Tue, 09 Jun 2015 17:13:12 -0700	[thread overview]
Message-ID: <1433895192.3165.67.camel@stgolabs.net> (raw)
In-Reply-To: <20150609152838.94774d7feafef3f7e6ccbd74@linux-foundation.org>

On Tue, 2015-06-09 at 15:28 -0700, Andrew Morton wrote:
> --- a/ipc/shm.c~ipcshm-move-bug_on-check-into-shm_lock-fix
> +++ a/ipc/shm.c
> @@ -155,14 +155,11 @@ static inline struct shmid_kernel *shm_l
>  {
>  	struct kern_ipc_perm *ipcp = ipc_lock(&shm_ids(ns), id);
>  
> -	if (IS_ERR(ipcp)) {
> -		/*
> -		 * We raced in the idr lookup or with shm_destroy(),
> -		 * either way, the ID is busted.
> -		 */
> -		BUG();
> -		return (struct shmid_kernel *)ipcp;
> -	}
> +	/*
> +	 * We raced in the idr lookup or with shm_destroy().  Either way, the
> +	 * ID is busted.
> +	 */
> +	BUG_ON(IS_ERR(ipcp));
>  
>  	return container_of(ipcp, struct shmid_kernel, shm_perm);
>  }
> 
> One benefit of the code you sent is that the unreachable `return' will
> prevent a compile warning when CONFIG_BUG=n, but CONFIG_BUG=n is silly
> and I never worry about it.

I took a closer look and the above looks Ok, and I don't care either way
about CONFIG_BUG=n.

Thanks,
Davidlohr

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-06-10  0:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-06 13:37 [PATCH -next 0/5] ipc: EIDRM/EINVAL returns & misc updates Davidlohr Bueso
2015-06-06 13:37 ` [PATCH 1/5] ipc,shm: move BUG_ON check into shm_lock Davidlohr Bueso
2015-06-09 22:28   ` Andrew Morton
2015-06-10  0:13     ` Davidlohr Bueso [this message]
2015-06-06 13:37 ` [PATCH 2/5] ipc,msg: provide barrier pairings for lockless receive Davidlohr Bueso
2015-06-06 13:37 ` [PATCH 3/5] ipc: rename ipc_obtain_object Davidlohr Bueso
2015-06-06 13:37 ` [PATCH 4/5] ipc,sysv: make return -EIDRM when racing with RMID consistent Davidlohr Bueso
2015-06-06 13:38 ` [PATCH 5/5] ipc,sysv: return -EINVAL upon incorrect id/seqnum Davidlohr Bueso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433895192.3165.67.camel@stgolabs.net \
    --to=dave@stgolabs.net \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=manfred@colorfullife.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).