Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus-6.17-1' of https://github.com/cminyard/linux-ipmi

Pull ipmi updates from Corey Minyard:
"Some small fixes for the IPMI driver

Nothing huge, some rate limiting on logs, a strncpy fix where the
source and destination could be the same, and removal of some unused
cruft"

* tag 'for-linus-6.17-1' of https://github.com/cminyard/linux-ipmi:
ipmi: Use dev_warn_ratelimited() for incorrect message warnings
char: ipmi: remove redundant variable 'type' and check
ipmi: Fix strcpy source and destination the same

+46 -25
+4 -4
drivers/char/ipmi/ipmi_msghandler.c
··· 4607 4607 * The NetFN and Command in the response is not even 4608 4608 * marginally correct. 4609 4609 */ 4610 - dev_warn(intf->si_dev, 4611 - "BMC returned incorrect response, expected netfn %x cmd %x, got netfn %x cmd %x\n", 4612 - (msg->data[0] >> 2) | 1, msg->data[1], 4613 - msg->rsp[0] >> 2, msg->rsp[1]); 4610 + dev_warn_ratelimited(intf->si_dev, 4611 + "BMC returned incorrect response, expected netfn %x cmd %x, got netfn %x cmd %x\n", 4612 + (msg->data[0] >> 2) | 1, msg->data[1], 4613 + msg->rsp[0] >> 2, msg->rsp[1]); 4614 4614 4615 4615 goto return_unspecified; 4616 4616 }
-4
drivers/char/ipmi/ipmi_si_intf.c
··· 2108 2108 static int __init init_ipmi_si(void) 2109 2109 { 2110 2110 struct smi_info *e, *e2; 2111 - enum ipmi_addr_src type = SI_INVALID; 2112 2111 2113 2112 if (initialized) 2114 2113 return 0; ··· 2188 2189 2189 2190 initialized = true; 2190 2191 mutex_unlock(&smi_infos_lock); 2191 - 2192 - if (type) 2193 - return 0; 2194 2192 2195 2193 mutex_lock(&smi_infos_lock); 2196 2194 if (unload_when_empty && list_empty(&smi_infos)) {
+42 -17
drivers/char/ipmi/ipmi_watchdog.c
··· 1146 1146 .smi_gone = ipmi_smi_gone 1147 1147 }; 1148 1148 1149 - static int action_op(const char *inval, char *outval) 1149 + static int action_op_set_val(const char *inval) 1150 1150 { 1151 - if (outval) 1152 - strcpy(outval, action); 1153 - 1154 - if (!inval) 1155 - return 0; 1156 - 1157 1151 if (strcmp(inval, "reset") == 0) 1158 1152 action_val = WDOG_TIMEOUT_RESET; 1159 1153 else if (strcmp(inval, "none") == 0) ··· 1158 1164 action_val = WDOG_TIMEOUT_POWER_DOWN; 1159 1165 else 1160 1166 return -EINVAL; 1161 - strcpy(action, inval); 1162 1167 return 0; 1163 1168 } 1164 1169 1165 - static int preaction_op(const char *inval, char *outval) 1170 + static int action_op(const char *inval, char *outval) 1166 1171 { 1172 + int rv; 1173 + 1167 1174 if (outval) 1168 - strcpy(outval, preaction); 1175 + strcpy(outval, action); 1169 1176 1170 1177 if (!inval) 1171 1178 return 0; 1179 + rv = action_op_set_val(inval); 1180 + if (!rv) 1181 + strcpy(action, inval); 1182 + return rv; 1183 + } 1172 1184 1185 + static int preaction_op_set_val(const char *inval) 1186 + { 1173 1187 if (strcmp(inval, "pre_none") == 0) 1174 1188 preaction_val = WDOG_PRETIMEOUT_NONE; 1175 1189 else if (strcmp(inval, "pre_smi") == 0) ··· 1190 1188 preaction_val = WDOG_PRETIMEOUT_MSG_INT; 1191 1189 else 1192 1190 return -EINVAL; 1193 - strcpy(preaction, inval); 1194 1191 return 0; 1195 1192 } 1196 1193 1197 - static int preop_op(const char *inval, char *outval) 1194 + static int preaction_op(const char *inval, char *outval) 1198 1195 { 1196 + int rv; 1197 + 1199 1198 if (outval) 1200 - strcpy(outval, preop); 1199 + strcpy(outval, preaction); 1201 1200 1202 1201 if (!inval) 1203 1202 return 0; 1203 + rv = preaction_op_set_val(inval); 1204 + if (!rv) 1205 + strcpy(preaction, inval); 1206 + return 0; 1207 + } 1204 1208 1209 + static int preop_op_set_val(const char *inval) 1210 + { 1205 1211 if (strcmp(inval, "preop_none") == 0) 1206 1212 preop_val = WDOG_PREOP_NONE; 1207 1213 else if (strcmp(inval, "preop_panic") == 0) ··· 1218 1208 preop_val = WDOG_PREOP_GIVE_DATA; 1219 1209 else 1220 1210 return -EINVAL; 1221 - strcpy(preop, inval); 1211 + return 0; 1212 + } 1213 + 1214 + static int preop_op(const char *inval, char *outval) 1215 + { 1216 + int rv; 1217 + 1218 + if (outval) 1219 + strcpy(outval, preop); 1220 + 1221 + if (!inval) 1222 + return 0; 1223 + 1224 + rv = preop_op_set_val(inval); 1225 + if (!rv) 1226 + strcpy(preop, inval); 1222 1227 return 0; 1223 1228 } 1224 1229 ··· 1270 1245 { 1271 1246 int rv; 1272 1247 1273 - if (action_op(action, NULL)) { 1248 + if (action_op_set_val(action)) { 1274 1249 action_op("reset", NULL); 1275 1250 pr_info("Unknown action '%s', defaulting to reset\n", action); 1276 1251 } 1277 1252 1278 - if (preaction_op(preaction, NULL)) { 1253 + if (preaction_op_set_val(preaction)) { 1279 1254 preaction_op("pre_none", NULL); 1280 1255 pr_info("Unknown preaction '%s', defaulting to none\n", 1281 1256 preaction); 1282 1257 } 1283 1258 1284 - if (preop_op(preop, NULL)) { 1259 + if (preop_op_set_val(preop)) { 1285 1260 preop_op("preop_none", NULL); 1286 1261 pr_info("Unknown preop '%s', defaulting to none\n", preop); 1287 1262 }