Files
s390-tools/ipl_tools/Makefile
Jan Höppner 6d382d30d9 ipl_tools: Allocate string buffer dynamically
Use util_asprintf() to allocate memory for the string buffers
dynamically and get rid of the following GCC8 compile warnings:

system.c: In function ‘print_fw_str’:
system.c:86:46: warning: ‘%s’ directive output may be truncated writing
up to 4095 bytes into a region of size 4082 [-Wformat-truncation=]
  snprintf(path, sizeof(path), "/sys/firmware/%s", file);
                                              ^~
system.c:98:19:
  read_fw_str(str, path, sizeof(str));
                   ~~~~
system.c:86:2: note: ‘snprintf’ output between 15 and 4110 bytes into a
destination of size 4096
  snprintf(path, sizeof(path), "/sys/firmware/%s", file);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cmd_chreipl.c: In function ‘set_reipl_type_helper’:
cmd_chreipl.c:316:19: warning: ‘%d’ directive writing between 1 and 11
bytes into a region of size between 0 and 4095 [-Wformat-overflow=]
  sprintf(cmd, "%s %d:%d", chreipl_helper, major(dev), minor(dev));
                   ^~
cmd_chreipl.c:316:15: note: using the range [-2147483648, 2147483647]
for directive argument
  sprintf(cmd, "%s %d:%d", chreipl_helper, major(dev), minor(dev));
               ^~~~~~~~~~
cmd_chreipl.c:316:15: note: using the range [-2147483648, 2147483647]
for directive argument
cmd_chreipl.c:316:2: note: ‘sprintf’ output between 5 and 4120 bytes
into a destination of size 4096
  sprintf(cmd, "%s %d:%d", chreipl_helper, major(dev), minor(dev));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-11-16 15:19:48 +01:00

44 lines
1.1 KiB
Makefile

include ../common.mak
libs = $(rootdir)/libutil/libutil.a
all: chreipl lsreipl chshut lsshut
libs = $(rootdir)/libutil/libutil.a
objects = main.o ccw.o fcp.o system.o shutdown.o \
cmd_lsshut.o cmd_chshut.o cmd_lsreipl.o cmd_chreipl.o proc.o
chreipl: $(objects) $(libs)
$(LINK) $(ALL_LDFLAGS) $^ $(LDLIBS) -o $@
lsreipl:
ln -sf chreipl lsreipl
chshut:
ln -sf chreipl chshut
lsshut:
ln -sf chreipl lsshut
clean:
rm -f *.o lsreipl chreipl chshut lsshut
install: all
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 chreipl \
$(DESTDIR)$(USRSBINDIR)
ln -f -s chreipl $(DESTDIR)$(USRSBINDIR)/lsreipl
ln -f -s chreipl $(DESTDIR)$(USRSBINDIR)/chshut
ln -f -s chreipl $(DESTDIR)$(USRSBINDIR)/lsshut
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 man/chreipl.8 \
$(DESTDIR)$(MANDIR)/man8
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 man/lsreipl.8 \
$(DESTDIR)$(MANDIR)/man8
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 man/lsshut.8 \
$(DESTDIR)$(MANDIR)/man8
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 man/chshut.8 \
$(DESTDIR)$(MANDIR)/man8
.PHONY: all install clean