From: Richard Knutsson <ricknu-0@student.ltu.se>
To: kernel-janitors@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Richard Knutsson <ricknu-0@student.ltu.se>
Subject: [PATCH 1/3] ipc: Convert handmade 'max' to max().
Date: Mon, 17 Dec 2007 03:35:55 +0100 (MET) [thread overview]
Message-ID: <20071217023555.24944.62155.sendpatchset@thinktank.campus.ltu.se> (raw)
Convert handmade 'max' to max().
Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
---
msg.c | 2 +-
sem.c | 2 +-
shm.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ipc/msg.c b/ipc/msg.c
index fdf3db5..74d0709 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -473,7 +473,7 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
up_read(&msg_ids(ns).rw_mutex);
if (copy_to_user(buf, &msginfo, sizeof(struct msginfo)))
return -EFAULT;
- return (max_id < 0) ? 0 : max_id;
+ return max(max_id, 0);
}
case MSG_STAT: /* msqid is an index rather than a msg queue id */
case IPC_STAT:
diff --git a/ipc/sem.c b/ipc/sem.c
index 35952c0..9ac00ac 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -641,7 +641,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, int semnum,
up_read(&sem_ids(ns).rw_mutex);
if (copy_to_user (arg.__buf, &seminfo, sizeof(struct seminfo)))
return -EFAULT;
- return (max_id < 0) ? 0: max_id;
+ return max(max_id, 0);
}
case SEM_STAT:
{
diff --git a/ipc/shm.c b/ipc/shm.c
index 3818fae..45e154a 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -704,7 +704,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
goto out;
}
- err = err < 0 ? 0 : err;
+ err = max(err, 0);
goto out;
}
case SHM_STAT:
next reply other threads:[~2007-12-17 2:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-17 2:35 Richard Knutsson [this message]
2007-12-17 2:36 ` [PATCH 2/3] msg.h: Convert m_ts from int to size_t Richard Knutsson
2007-12-22 10:31 ` Andrew Morton
2007-12-17 2:36 ` [PATCH 3/3] ipc: Convert handmade 'min' to min() Richard Knutsson
2007-12-22 10:27 ` [PATCH 1/3] ipc: Convert handmade 'max' to max() Andrew Morton
2008-01-04 6:46 ` Richard Knutsson
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=20071217023555.24944.62155.sendpatchset@thinktank.campus.ltu.se \
--to=ricknu-0@student.ltu.se \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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